Reputation: 1731
I currently have an ElasticSearch 5.4 instance hosted on the Elasticsearch service AWS provides. However, this service locks down several API calls such as the ones for closing and opening the server. Because of this, I cannot update the settings to have a custom tokenizer from my knowledge. There must be a way to add this tokenizer on indice creation rather than after.
My question is - how do I add this custom tokenizer when putting the mappings/creating them rather than afterwards (since I would have to close the server to adjust these settings after making the index).
analysis: {
analyzer: {
ngram_analyzer: {
tokenizer: "ngram_compounder"
}
},
tokenizer: {
ngram_compounder: {
type: "ngram",
min_gram: 3,
max_gram: 3,
token_chars: [
"letter",
"digit"
]
}
}
},
Upvotes: 0
Views: 1089
Reputation: 324
You can embed this into your mapping via "settings":
{
"settings": {
"analysis": {
"analyzer": {
"ngram_analyzer": {
"tokenizer": "ngram_compounder"
}
},
"tokenizer": {
"ngram_compounder": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
"mappings": {
"index_1": {...},
"index_2": {...}
}
}
This worked for me in ES 1.7.x and should be still applicable as well.
Cheers, Dominik
Upvotes: 3