I am using python api - http://elasticsearch-py.readthedocs.org
How can I set change the index analyzer and tokenizer for the index? Thanks
I found suggestions to change the mapping of the index, but there was no documentation on how to do that from python.
Partial Search using Analyzer in ElasticSearch shows settings for n-gram-analyzer but no code to implement it in python.
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
)
Check the examples here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With