# Synonym configuration

**URL:** <https://discuss.elastic.co/t/synonym-configuration/15334>\
**Category:** Elasticsearch\
**Created:** [January 21, 2014, 5:25am UTC](https://discuss.elastic.co/t/synonym-configuration/15334 "2014-01-21T05:25:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [January 21, 2014, 5:25am UTC](https://discuss.elastic.co/t/synonym-configuration/15334/1 "2014-01-21T05:25:17Z")

</div>

Hi ,

I read about in lot of places That There are two approaches when working  
with synonyms :

- expanding them at indexing time,
- expanding them at query time.

Expanding synonyms at query time is not recommended since it raises issues  
with :

- scoring, since synonyms have different document frequencies,
- multi-token synonyms, since the query parser splits on white spaces.

so to configure expanding synonym ant index time in elastic search what is  
the configuration.  
right now my configuration is as below , i am using synonym filter both in  
index analyzer and query analyzer so that means i am expanding index  
time and query time.

"name":{  
"type":"string",  
"index\_analyzer" : "autocomplete\_index",  
"search\_analyzer" : "autocomplete\_search"  
},

{  
"settings":{  
"analysis":{  
"analyzer":{  
"synonym":{  
"tokenizer":"whitespace",  
"filter":[  
"lowercase",  
"syns\_filter"  
]  
},  
"autocomplete\_search":{  
"type":"custom",  
"tokenizer":"whitespace",  
"filter":[  
"lowercase",  
"syns\_filter",  
"stop"  
]  
},  
"autocomplete\_index":{  
"type":"custom",  
"tokenizer":"whitespace",  
"filter":[  
"lowercase",  
"syns\_filter",  
"stop",  
"my\_edgeNgram"  
]  
}  
"filter":{  
"syns\_filter":{  
"synonyms\_path":"synonyms/synonym\_collegename.txt",  
"type":"synonym",  
"ignore\_case":true,  
"expand":false  
}  
}  
}}}}

-paul

--  
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/1c21cd11-eb92-47b5-b695-61b33bd256fa%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c21cd11-eb92-47b5-b695-61b33bd256fa%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)\
**Post date:** [January 21, 2014, 8:58am UTC](https://discuss.elastic.co/t/synonym-configuration/15334/2 "2014-01-21T08:58:24Z")

</div>

I got the answer by searching Google groups.

On Tue, Jan 21, 2014 at 10:55 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:

> Hi ,
> 
> I read about in lot of places That There are two approaches when working  
> with synonyms :
> 
> - expanding them at indexing time,
> - expanding them at query time.
> 
> Expanding synonyms at query time is not recommended since it raises issues  
> with :
> 
> - scoring, since synonyms have different document frequencies,
> - multi-token synonyms, since the query parser splits on white spaces.
> 
> so to configure expanding synonym ant index time in Elasticsearch what is  
> the configuration.  
> right now my configuration is as below , i am using synonym filter both in  
> index analyzer and query analyzer so that means i am expanding index  
> time and query time.
> 
> "name":{  
> "type":"string",  
> "index\_analyzer" : "autocomplete\_index",  
> "search\_analyzer" : "autocomplete\_search"  
> },
> 
> {  
> "settings":{  
> "analysis":{  
> "analyzer":{  
> "synonym":{  
> "tokenizer":"whitespace",  
> "filter":[  
> "lowercase",  
> "syns\_filter"  
> ]  
> },  
> "autocomplete\_search":{  
> "type":"custom",  
> "tokenizer":"whitespace",  
> "filter":[  
> "lowercase",  
> "syns\_filter",  
> "stop"  
> ]  
> },  
> "autocomplete\_index":{  
> "type":"custom",  
> "tokenizer":"whitespace",  
> "filter":[  
> "lowercase",  
> "syns\_filter",  
> "stop",  
> "my\_edgeNgram"  
> ]  
> }  
> "filter":{  
> "syns\_filter":{  
> "synonyms\_path":"synonyms/synonym\_collegename.txt",  
> "type":"synonym",  
> "ignore\_case":true,  
> "expand":false  
> }  
> }  
> }}}}
> 
> -paul
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/DTf-1Q0oaSw/unsubscribe](https://groups.google.com/d/topic/elasticsearch/DTf-1Q0oaSw/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/1c21cd11-eb92-47b5-b695-61b33bd256fa%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1c21cd11-eb92-47b5-b695-61b33bd256fa%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAO066G3%2BM1%3DZxijZ%3DtKDZp-QOJCpZnXz8VHhuDJaOcPP65NPKA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAO066G3%2BM1%3DZxijZ%3DtKDZp-QOJCpZnXz8VHhuDJaOcPP65NPKA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:55am UTC](https://discuss.elastic.co/t/synonym-configuration/15334/3 "2017-07-06T01:55:42Z")

</div>


