I am trying to add synonyms to elastic search as show in this link using a file but it gives me the following error https://www.elastic.co/guide/en/elasticsearch/reference/5.2/analysis-synonym-tokenfilter.html
error":{"root_cause":[{"type":"illegal_argument_exception","reason":"IOException while reading synonyms_path_path: ],"type":"illegal_argument_exception","reason":"IOException while reading synonyms_path_path: (No such file or directory)"}},"status":400}
My mapping code looks like this and synonyms.txt is within the same folder (same level):
'settings': {
'analysis': {
'filter': {
'english_stemmer': {
'type': 'stemmer',
'language': 'english'
},
'english_possessive_stemmer': {
'type': 'stemmer',
'language': 'possessive_english'
},
'my_synonyms': {
'type': 'synonym',
'synonyms_path' : 'synonyms.txt'
}
},
'analyzer': {
'my_analyzer': {
'tokenizer': 'standard',
'filter': [
'english_possessive_stemmer',
'lowercase',
'my_synonyms',
'english_stemmer'
]
}
}
}
},
'mappings' : ...
Actually your problem is that you apparently can't submit a synonyms file to AWS and the only way you can do to use synonyms with this configuration is to upload synonyms via API following:
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/analysis-synonym-tokenfilter.html
which is not useful for a great number of synonyms.
See this other answer to a similar question for reference:
Is there any difference between using synonyms_path and using synonyms when specifying synonym filter for Elasticsearch?
and this taken directly from AWS forum:
https://forums.aws.amazon.com/message.jspa?messageID=679800
And btw, the path actually should be analysis/synonyms.txt, but again, only if you were able to upload the synonyms file to AWS.
Elasticsearch is expecting to receive relative path to synonyms.txt starting from the config location. For example, if your synonyms.txt is located at config/settings/synonyms.txt
the correct path is "settings/synonyms.txt"
With support for custom dictionaries, Amazon Elasticsearch Service can now import your dictionary files from Amazon S3 and make them available to be associated with your Amazon Elasticsearch Service domain(s) as needed. Custom dictionary support is available for all versions of Elasticsearch on Amazon Elasticsearch Service. To learn more, see the documentation
documentation link
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