# Update synonyms dynamically

**URL:** <https://discuss.elastic.co/t/update-synonyms-dynamically/16786>\
**Category:** Elasticsearch\
**Created:** [April 3, 2014, 12:26pm UTC](https://discuss.elastic.co/t/update-synonyms-dynamically/16786 "2014-04-03T12:26:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balaji\_Narain](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Balaji\_Narain](https://discuss.elastic.co/u/Balaji_Narain)\
**Post date:** [April 3, 2014, 12:26pm UTC](https://discuss.elastic.co/t/update-synonyms-dynamically/16786/1 "2014-04-03T12:26:14Z")

</div>

Hi,

I have synonyms defined for certain codes that could be updated through  
my system. These updates are infrequent: in the order of months and in some  
cases, it could be years. I am planning to use the synonym token filter.  
Can I do this update without modifying the synonyms list? I am fine with  
either programmatic solutions, or solutions which would require  
elasticsearch to source the list of synonyms from an external source. Is it  
possible with ES?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b08aa78f-2094-4892-a4ef-c69e240009ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b08aa78f-2094-4892-a4ef-c69e240009ec%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 4, 2014, 8:17pm UTC](https://discuss.elastic.co/t/update-synonyms-dynamically/16786/2 "2014-04-04T20:17:16Z")

</div>

Not sure I understand your question completely, but you can define a  
synonym filter to read from an external file it that matters:

```
    "filter": {
      "syn1": {
        "type": "synonym",
        "synonyms_path": "synonyms.txt"
      }
    }

```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d86ce9e4-11a0-401a-a80a-d3d459ee0d92%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d86ce9e4-11a0-401a-a80a-d3d459ee0d92%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Balaji\_Narain](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@Balaji\_Narain](https://discuss.elastic.co/u/Balaji_Narain)\
**Post date:** [April 7, 2014, 9:49am UTC](https://discuss.elastic.co/t/update-synonyms-dynamically/16786/3 "2014-04-07T09:49:11Z")

</div>

I am sorry for the vague question; I should have phrased it better.

Yes, I am aware of the fact that you could upload the synonyms from a file.  
But this does not work out in my scenario because, I would like the synonym  
to be updated by my application program. As I understand, it is not yet  
possible to update the synonyms.txt through the application program. Hence  
I was wondering if I could provide the synonym mapping from a database/URL  
so that it could be updated through my application.

On Saturday, April 5, 2014 1:47:16 AM UTC+5:30, Binh Ly wrote:

> Not sure I understand your question completely, but you can define a  
> synonym filter to read from an external file it that matters:
> 
> ```
> "filter": {
> "syn1": {
> "type": "synonym",
> "synonyms_path": "synonyms.txt"
> }
> }
> 
> ```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/58576ccd-b3b2-4661-9b0e-7eba99f3258a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/58576ccd-b3b2-4661-9b0e-7eba99f3258a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:37am UTC](https://discuss.elastic.co/t/update-synonyms-dynamically/16786/4 "2017-07-06T01:37:52Z")

</div>


