# Should I reimport data after updating synonyms file

**URL:** <https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560>\
**Category:** Elasticsearch\
**Created:** [October 21, 2016, 2:36am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560 "2016-10-21T02:36:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent2easy](https://avatars.discourse-cdn.com/v4/letter/v/e95f7d/32.png) [@vincent2easy](https://discuss.elastic.co/u/vincent2easy)\
**Post date:** [October 21, 2016, 2:36am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/1 "2016-10-21T02:36:05Z")

</div>

Hi All,

I was wondering, If I update the synonyms files, do I need to reload the data into ES?  
Because I have tried to only restart ES after updating synonyms files, but it does not work.  
If it is so, do you have any more efficient solution, since reloading data is quite frustrated..

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 21, 2016, 5:40am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/2 "2016-10-21T05:40:05Z")

</div>

You need to restart all nodes.  
And you need to reindex.

Synonyms are applied at index time and at query time as well to parse your text.  
If you don't reindex you might have unpredictable results.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 21, 2016, 9:32am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/3 "2016-10-21T09:32:32Z")

</div>

Synonyms can be used to expand or contract.  
**expand** : jump becomes skip and hop too  
**contract** : jump and skip are normalized to hop.

In the case of expansions you need only apply the synonym analyzer to the docs at index time or the queries at query time.  
**Index-time expansion** = faster queries but requires reindexing when synonyms change  
**Query-time expansion** = slower queries and no need to reindex when synonyms change

For contraction use cases the queries and indexed docs both need to be in agreement in what to normalize words to and so changes to synonyms require a reindex.

---

<div class="post-metadata">

**Author:** ![vincent2easy](https://avatars.discourse-cdn.com/v4/letter/v/e95f7d/32.png) [@vincent2easy](https://discuss.elastic.co/u/vincent2easy)\
**Post date:** [October 24, 2016, 2:18am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/4 "2016-10-24T02:18:26Z")

</div>

Thanks! Got it.

I might reindex them periodically,  
but one thing is, I might require the query time synonyms come into force once the synonyms file is edited in real time.  
So my question is: Can I achieve query time synonyms update by other method and not restarting all nodes? Since restarting may cost quite a time (during which the system is not working) which is not desired.  
Do you have any idea on this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 24, 2016, 6:11am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/5 "2016-10-24T06:11:02Z")

</div>

OIf synonyms are on a file, then you need to restart.  
If you defined synonyms using the REST API, then I think that you don't have to restart (but I never tried it).

---

<div class="post-metadata">

**Author:** ![vincent2easy](https://avatars.discourse-cdn.com/v4/letter/v/e95f7d/32.png) [@vincent2easy](https://discuss.elastic.co/u/vincent2easy)\
**Post date:** [October 24, 2016, 6:39am UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/6 "2016-10-24T06:39:33Z")

</div>

Understood. Thanks for your answer and patience! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:10pm UTC](https://discuss.elastic.co/t/should-i-reimport-data-after-updating-synonyms-file/63560/7 "2017-07-05T22:10:19Z")

</div>


