Elasticsearch Python - Index Analyzer & Search Analyzer
我正在使用python API-http://elasticsearch-py.readthedocs.org
如何设置更改索引的索引分析器和标记器?谢谢
我发现了更改索引映射的建议,但是没有有关如何从python进行操作的文档。
ElasticSearch中使用分析器的部分搜索显示了n-gram-analyzer的设置,但没有代码可在python中实现。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | client.indices.create( index=index, body={ 'settings': { # just one shard, no replicas for testing 'number_of_shards': 1, 'number_of_replicas': 0, # custom analyzer for analyzing file paths 'analysis': { 'analyzer': { 'file_path': { 'type': 'custom', 'tokenizer': 'path_hierarchy', 'filter': ['lowercase'] } } } } }, # Will ignore 400 errors, remove to ensure you're prompted ignore=400 ) |
在此处查看示例。