My synonyms are stored in a database and, when the synonyms are changed in the database, I want to update any values in the index which may be changed as a result of the synonym change.
There are two parts to this that I can think of. One, figuring out which documents to re-index. Two, figuring out how to tell ElasticSearch that the synonyms have changed. I am struggling with the 2nd one - telling ElasticSearch that the synonyms have changed.
A similar question has been asked - see Change dynamically elasticsearch synonyms - but from reading the answers in that issue, I have not been able to figure out what I need.
Currently, my configuration file looks something like the following:
index :
analysis :
analyzer :
myanalyzer :
filter: [standard, mysynonymfilter]
filter :
mysynonymfilter :
type : synonym
synonyms : synonyms.txt
ignore_case : false
expand : true
format : solr
My idea was to do something like the following:
curl -XPUT 'http://127.0.0.1:9200/foo/_settings' -d '
{
"filter" : {
"synonym" : {
"type" : "mysynonymfilter",
"synonyms" : [
"cosmos, universe"
]
}
}
}
'
but that doesn't seem to do what I want. That is, the index settings do not get updated as far as I can tell.
Is what I am trying to do possible? And if so, any idea what I am doing wrong?
Also, I am fairly sure I could get this to work by updating the synonym file (if I have to use a file), but that's a bit more complicated and something I'd like to avoid.
Thanks for your help, Eric