# About Synonym toke filter

**URL:** <https://discuss.elastic.co/t/about-synonym-toke-filter/294501>\
**Category:** Elasticsearch\
**Created:** [January 16, 2022, 2:09pm UTC](https://discuss.elastic.co/t/about-synonym-toke-filter/294501 "2022-01-16T14:09:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aniket\_Pant](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aniket\_Pant](https://discuss.elastic.co/u/Aniket_Pant)\
**Post date:** [January 16, 2022, 2:09pm UTC](https://discuss.elastic.co/t/about-synonym-toke-filter/294501/1 "2022-01-16T14:09:34Z")

</div>

I am using synonym token filter in my mapping but it has a property called `synonyms_path`.

```auto
PUT /_template/ise
{
   "index_patterns" : ["log-ise-*"],
    "settings": {
      "index.lifecycle.name":"ise_policy",
      "index.lifecycle.rollover_alias":"log-ise",
      "number_of_replicas": 0,
      "analysis": {
        "analyzer": {
          "my_analyzer_1":{
            "type":"custom",
            "tokenizer":"standard",
            "filter":["lowercase","autocomplete"]
          },
          "my_keyword_analyzer" : {
              "filter" : [
                "lowercase",
                "custom_synonyms"
              ],
              "type" : "custom",
              "tokenizer" : "keyword"
            }
          },
        "filter": {
          "autocomplete" : {
              "type" : "edge_ngram",
              "min_gram" : "3",
              "max_gram" : "20"
            },
              "custom_synonyms" : {
              "type" : "synonym",
              "synonyms_path" : "analysis/ise_synonyms.txt"
            }

        }
      }
    },
    "mappings": {
      "properties": {
        "username" : {
          "analyzer" : "my_analyzer_1",
          "type" : "text",
          "search_analyzer": "standard"
        },
        "event_name":{
          "analyzer":"my_keyword_analyzer",
          "type":"text"
        },
        "geoip" : {
          "type" : "object",
          "properties" : {
            "ip" : {
              "type" : "ip"
            },
            "latitude" : {
              "type" : "half_float"
            },
            "location" : {
              "type" : "geo_point"
            },
            "longitude" : {
              "type" : "half_float"
            }
          }
        },
        "source_ip" : {
          "type" : "ip"
        }
      }
    }
}

```

I have file called **ise\_synonyms.txt** in **/etc/Elasticsearch/** i have provided the synonym words.  
I am running 8 Elasticsearch server in a cluster and i have to provide this file `ise_synonyms.txt` in all 8 servers and adding one new word to this file lead me to do editing in all servers.  
Isn't it very hactic ?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 25, 2022, 3:37pm UTC](https://discuss.elastic.co/t/about-synonym-toke-filter/294501/2 "2022-01-25T15:37:08Z")

</div>

Indeed you have to share that file across all your Elasticsearch nodes and make sure it is up to date. If it is only a small list of synonyms, you could specify them as part of the index/template creation. I do think, that the file is the better approach (if you have a good mechanism of keeping it in sync).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Aniket\_Pant](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aniket\_Pant](https://discuss.elastic.co/u/Aniket_Pant)\
**Post date:** [January 28, 2022, 10:32am UTC](https://discuss.elastic.co/t/about-synonym-toke-filter/294501/3 "2022-01-28T10:32:49Z")

</div>

i kept the file in all data nodes of Elasticsearch.

---

<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:** [February 25, 2022, 10:33am UTC](https://discuss.elastic.co/t/about-synonym-toke-filter/294501/4 "2022-02-25T10:33:28Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
