So I have an index with the synonym mapping defined in the search analyzer. When I first created the index, the synonyms were picked up on search. After that, I updated the synonyms.txt
files on the nodes once to update a synonym mapping and restarted each node after making a change. This caused the synonym change to be reflected on search thoughout the index.
Now, when I change the synonyms file and restart the nodes, the synonym mapping isn't updating as I believe it should. Am I missing something? I thought since the synonym mapping was on a search_analyzer I wouldn't have to reindex each time to reflect the changes.
Here is my index definition:
PUT /synonym_index
{
"aliases": {},
"mappings": {
"_doc": {
"properties": {
"name": {
"type": "text",
"fields": {
"english": {
"type": "text",
"analyzer": "english",
"search_analyzer":"english_and_synonyms"
}
}
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"english": {
"tokenizer": "standard",
"filter": [
"english_possessive_stemmer",
"lowercase",
"english_stop",
"english_keywords",
"english_stemmer"
]
},
"english_and_synonyms": {
"tokenizer": "standard",
"filter": [
"search_synonyms",
"english_possessive_stemmer",
"lowercase",
"english_stop",
"english_keywords",
"english_stemmer"
]
}
},
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
},
"english_keywords": {
"type": "keyword_marker",
"keywords": ["example"]
},
"english_stemmer": {
"type": "stemmer",
"language": "english"
},
"english_possessive_stemmer": {
"type": "stemmer",
"language": "possessive_english"
},
"search_synonyms" : {
"type" : "synonym_graph",
"synonyms_path" : "analysis/synonyms.txt"
}
}
},
"index": {
"number_of_shards": "5",
"number_of_replicas": "1"
}
}
}
I've tried restarting the node with
sudo service elasticsearch restart
and also with
sudo service elasticsearch stop sudo service elasticsearch start
but neither are causing my changes to reflect. Do I need to reindex every time I update the synonyms file even though it's a search analyzer?