# Synonym not working for some entry

**URL:** <https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863>\
**Category:** Elasticsearch\
**Created:** [December 14, 2013, 1:24pm UTC](https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863 "2013-12-14T13:24:29Z")\
**Posts on this page:** 5\
**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:** [December 14, 2013, 1:24pm UTC](https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863/1 "2013-12-14T13:24:29Z")

</div>

The synonym entries marked in yellow does not work When i search mit it  
does not show any results but it works for other entries

ES version 0.90.0  
Java Version "1.7.0\_45"

my synonym .txt

russia, ussr, russian federation  
fui, Florida International University  
rate, rating ,rated  
mit, mass  
jkt, JKTyres

My setting and mapping file

{  
"settings":{  
"analysis":{  
"analyzer":{  
"synonym":{  
"tokenizer":"whitespace",  
"filter":[  
"standard",  
"lowercase",  
"syns\_filter"  
]  
}  
},  
"filter":{  
"syns\_filter":{  
"synonyms\_path":"synonyms/synonym\_country.txt",  
"type":"synonym"  
}  
}  
}  
},  
"mappings":{  
"home":{  
"properties":{  
"name":{  
"type":"string",  
"analyzer":"synonym"  
}  
}  
}  
}  
}

--  
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/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%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:** ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)\
**Post date:** [December 14, 2013, 2:03pm UTC](https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863/2 "2013-12-14T14:03:21Z")

</div>

Hi paul,

What kind of your document and query, you fail to search?

I think that “fui” and “jkt” synonym entries does not work, because “Florida International University” and “JKTyres” include UpperCase character.  
Your filter chain has the synonym filter after the lowercase filter.  
Your document data indexed all lowercase terms by your analyzer, but your query (ex: “jkt") expand “jkt” OR “JKTyres” by synonym filter.

However, I don’t know why “mlt” entry does not work, because “mit” entry is all lowercase character.

Does it make sense?

Regards,

* * *

Jun Ohtani  
[johtani@gmail.com](mailto:johtani@gmail.com)  
blog : [http://blog.johtani.info](http://blog.johtani.info)  
twitter : [http://twitter.com/johtani](http://twitter.com/johtani)

2013/12/14 22:24、paul のメール：

> The synonym entries marked in yellow does not work When i search mit it does not show any results but it works for other entries
> 
> ES version 0.90.0  
> Java Version "1.7.0\_45"
> 
> my synonym .txt
> 
> russia, ussr, russian federation  
> fui, Florida International University  
> rate, rating ,rated  
> mit, mass  
> jkt, JKTyres
> 
> My setting and mapping file
> 
> {  
> "settings":{  
> "analysis":{  
> "analyzer":{  
> "synonym":{  
> "tokenizer":"whitespace",  
> "filter":[  
> "standard",  
> "lowercase",  
> "syns\_filter"  
> ]  
> }  
> },  
> "filter":{  
> "syns\_filter":{  
> "synonyms\_path":"synonyms/synonym\_country.txt",  
> "type":"synonym"  
> }  
> }  
> }  
> },  
> "mappings":{  
> "home":{  
> "properties":{  
> "name":{  
> "type":"string",  
> "analyzer":"synonym"  
> }  
> }  
> }  
> }  
> }
> 
> --  
> 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/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%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:** [December 14, 2013, 2:58pm UTC](https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863/3 "2013-12-14T14:58:24Z")

</div>

thank you for the response i will add "ignore\_case":true and test

On Sat, Dec 14, 2013 at 7:33 PM, Jun Ohtani [johtani@gmail.com](mailto:johtani@gmail.com) wrote:

> Hi paul,
> 
> What kind of your document and query, you fail to search?
> 
> I think that “fui” and “jkt” synonym entries does not work, because  
> “Florida International University” and “JKTyres” include UpperCase  
> character.  
> Your filter chain has the synonym filter after the lowercase filter.  
> Your document data indexed all lowercase terms by your analyzer, but your  
> query (ex: “jkt") expand “jkt” OR “JKTyres” by synonym filter.
> 
> However, I don’t know why “mlt” entry does not work, because “mit” entry  
> is all lowercase character.
> 
> Does it make sense?
> 
> Regards,
> 
> * * *
> 
> Jun Ohtani  
> [johtani@gmail.com](mailto:johtani@gmail.com)  
> blog : [http://blog.johtani.info](http://blog.johtani.info)  
> twitter : [http://twitter.com/johtani](http://twitter.com/johtani)
> 
> 2013/12/14 22:24、paul のメール：
> 
> > The synonym entries marked in yellow does not work When i search mit it  
> > does not show any results but it works for other entries
> > 
> > ES version 0.90.0  
> > Java Version "1.7.0\_45"
> > 
> > my synonym .txt
> > 
> > russia, ussr, russian federation  
> > fui, Florida International University  
> > rate, rating ,rated  
> > mit, mass  
> > jkt, JKTyres
> > 
> > My setting and mapping file
> > 
> > {  
> > "settings":{  
> > "analysis":{  
> > "analyzer":{  
> > "synonym":{  
> > "tokenizer":"whitespace",  
> > "filter":[  
> > "standard",  
> > "lowercase",  
> > "syns\_filter"  
> > ]  
> > }  
> > },  
> > "filter":{  
> > "syns\_filter":{  
> > "synonyms\_path":"synonyms/synonym\_country.txt",  
> > "type":"synonym"  
> > }  
> > }  
> > }  
> > },  
> > "mappings":{  
> > "home":{  
> > "properties":{  
> > "name":{  
> > "type":"string",  
> > "analyzer":"synonym"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > --  
> > 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/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%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/CAO066G3FXzCZOutt0iMVo-3H9bnos\_pHWP%3DLNhi86WtNe0L%3DkQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAO066G3FXzCZOutt0iMVo-3H9bnos_pHWP%3DLNhi86WtNe0L%3DkQ%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:** ![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:** [December 14, 2013, 3:09pm UTC](https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863/4 "2013-12-14T15:09:42Z")

</div>

Hi Jun,  
Adding "ignore\_case":true worked and for the "mit" there was some special  
character between words a double space or something mit, mass marked in red when  
i changed it to no space it worked. is there a specific format  
for synonym file and what should be the character encoding.

On Saturday, 14 December 2013 19:33:21 UTC+5:30, Jun Ohtani wrote:

> Hi paul,
> 
> What kind of your document and query, you fail to search?
> 
> I think that “fui” and “jkt” synonym entries does not work, because  
> “Florida International University” and “JKTyres” include UpperCase  
> character.  
> Your filter chain has the synonym filter after the lowercase filter.  
> Your document data indexed all lowercase terms by your analyzer, but your  
> query (ex: “jkt") expand “jkt” OR “JKTyres” by synonym filter.
> 
> However, I don’t know why “mlt” entry does not work, because “mit” entry  
> is all lowercase character.
> 
> Does it make sense?
> 
> Regards,
> 
> * * *
> 
> Jun Ohtani  
> [joh...@gmail.com](mailto:joh...@gmail.com) \<javascript:\>  
> blog : [http://blog.johtani.info](http://blog.johtani.info)  
> twitter : [http://twitter.com/johtani](http://twitter.com/johtani)
> 
> 2013/12/14 22:24、paul のメール：
> 
> > The synonym entries marked in yellow does not work When i search mit it  
> > does not show any results but it works for other entries
> > 
> > ES version 0.90.0  
> > Java Version "1.7.0\_45"
> > 
> > my synonym .txt
> > 
> > russia, ussr, russian federation  
> > fui, Florida International University  
> > rate, rating ,rated  
> > mit, mass  
> > jkt, JKTyres
> > 
> > My setting and mapping file
> > 
> > {  
> > "settings":{  
> > "analysis":{  
> > "analyzer":{  
> > "synonym":{  
> > "tokenizer":"whitespace",  
> > "filter":[  
> > "standard",  
> > "lowercase",  
> > "syns\_filter"  
> > ]  
> > }  
> > },  
> > "filter":{  
> > "syns\_filter":{  
> > "synonyms\_path":"synonyms/synonym\_country.txt",  
> > "type":"synonym"  
> > }  
> > }  
> > }  
> > },  
> > "mappings":{  
> > "home":{  
> > "properties":{  
> > "name":{  
> > "type":"string",  
> > "analyzer":"synonym"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05d67cdd-0c9c-4e2a-a9d4-97c48f912f7d%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/e3f99085-b34d-4636-8f37-46e85e2f2f3c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e3f99085-b34d-4636-8f37-46e85e2f2f3c%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:** ![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, 2:01am UTC](https://discuss.elastic.co/t/synonym-not-working-for-some-entry/14863/5 "2017-07-06T02:01:13Z")

</div>


