I'm trying to configure one of my fields to use an edge ngram tokenizer. I'm trying to translate the following gist that I found (https://gist.github.com/1037563):
{
"mappings": {
"contact": {
"properties": {
"twitter": {
"type": "object",
"properties": {
"profile": {
"fields": {
"profile": {
"type": "string",
"analyzer": "left"
},
"reverse_profile": {
"type": "string",
"analyzer": "right"
}
},
"type": "multi_field"
}
}
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"left": {
"filter": [
"standard",
"lowercase",
"stop"
],
"type": "custom",
"tokenizer": "left_tokenizer"
},
"right": {
"filter": [
"standard",
"lowercase",
"stop"
],
"type": "custom",
"tokenizer": "right_tokenizer"
}
},
"tokenizer": {
"left_tokenizer": {
"side": "front",
"max_gram": 20,
"type": "edgeNGram"
},
"right_tokenizer": {
"side": "back",
"max_gram": 20,
"type": "edgeNGram"
}
}
}
}
}
I can see pyes supports the 'put_mapping' API, but this seems to wrap everything inside 'mappings'. I need to be able to pass the analyzer under a 'settings' key and can't work out how to.
Can anyone help?
You should be able to pass this structure as the second parameter of create_index.