we are going to define synonyms with multi-language support in our ES indexes.
Right now, we have totally 10 indexes, all of which need multi-language support, that is, for any field need multi-language index/query, we define multiple fields each of which for a certain language with specific language analyzer, for example, title_en, title_de, etc...,
So, to support synonyms, we have to overwrite the language analyzer to add synonyms support,
e.g,
"english": {
"tokenizer": "standard",
"filter": [
"english_possessive_stemmer",
"lowercase",
"english_stop",
"english_keywords",
"english_stemmer",
"my_synonyms"
]
},
we just copy the language analyzer definition from:
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lang-analyzer.html
but add "my_synonyms" to the filter array, and the "my_synonyms" is defined as follows:
"my_synonyms": {
"type": "synonym",
"synonyms_path": "analysis/synonyms.txt"
}
It works, but we have to overwrite all language analyzers in our index schema, and have to repeat them in all indexes.
Is there any way to simplify the synonyms implementation for our case?