I am using official elasticsearch docker image to run my elasticsearch instance.
I am trying to create an index with some filters which require to load some files (synonym filter, stopword filter...) none of such filters works because I get errors such as this one:
{
"error": "RemoteTransportException[[Hood][inet[/172.17.0.6:9300]][indices:admin/create]]; nested: IndexCreationException[[admin] failed to create index]; nested: FailedToResolveConfigException[Failed to resolve config path [/usr/share/elasticsearch/config/synonyms/sk_SK.txt], tried file path [/usr/share/elasticsearch/config/synonyms/sk_SK.txt], path file [/opt/logstash/config/usr/share/elasticsearch/config/synonyms/sk_SK.txt], and classpath]; ",
"status": 500
}
this is my code to create the index:
POST /admin
{
"settings": {
"analysis": {
"filter": {
"synonym_filter": {
"type": "synonym",
"synonyms_path": "/usr/share/elasticsearch/config/synonyms/sk_SK.txt",
"ignore_case": true
},
"sk_SK" : {
"type" : "hunspell",
"locale" : "sk_SK",
"dedup" : true,
"recursion_level" : 0
},
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer": {
"slovencina_synonym": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"synonym_filter",
"asciifolding"
]
},
"slovencina": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"asciifolding"
]
},
"nGram_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
]
},
"whitespace_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
}
}
The file is there on that path of course inside this docker container.
I was googling the error and I have read some posts that the problem is in file/folder permissions, so I tried the following:
sudo chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/config/*
chmod o+x /usr
chmod o+x /usr/share
chmod o+x /usr/share/elasticsearch
chmod o+x /usr/share/elasticsearch/config/
still did not work after this.
Since this is happening inside docker container which is using official docker elasticsearch image, I consider this as a bug and this should work out of the box, yet I did not find any solution for this. I would appreciate if anyone could post some workaround.