# How to configure and implement Synonyms with multi words

**URL:** <https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162>\
**Category:** Elasticsearch\
**Created:** [January 9, 2014, 8:42am UTC](https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162 "2014-01-09T08:42:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsbonline2006](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jsbonline2006](https://discuss.elastic.co/u/jsbonline2006)\
**Post date:** [January 9, 2014, 8:42am UTC](https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162/1 "2014-01-09T08:42:05Z")

</div>

Hi,

I have following Synonyms that I want to configure.

software engineer =\> software engineer, se,  
senior software engineer =\> senior software engineer , see  
team lead =\> team lead, lead, tl

So that If I searched for se or Software Engineer it should return me the  
records having software engineer.

What mapping I should apply on Designation field? and what query I should  
fire to get the result....  
It is possible to use multi\_match query?

Following are the query to create the records.

curl -XPUT '[http://localhost:9200/employee/test/1?pretty](http://localhost:9200/employee/test/1?pretty)' -d  
'{"designation": "software engineer"}'  
curl -XPUT '[http://localhost:9200/employee/test/2?pretty](http://localhost:9200/employee/test/2?pretty)' -d  
'{"designation": "software engineer"}'  
curl -XPUT '[http://localhost:9200/employee/test/3?pretty](http://localhost:9200/employee/test/3?pretty)' -d  
'{"designation": "senior software engineer"}'  
curl -XPUT '[http://localhost:9200/employee/test/4?pretty](http://localhost:9200/employee/test/4?pretty)' -d  
'{"designation": "senior software engineer"}'  
curl -XPUT '[http://localhost:9200/employee/test/5?pretty](http://localhost:9200/employee/test/5?pretty)' -d  
'{"designation": "team lead"}'  
curl -XPUT '[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)' -d  
'{"designation": "team lead"}'

--  
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/486c56cf-11a3-4b14-b5b4-66e4a465cb13%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/486c56cf-11a3-4b14-b5b4-66e4a465cb13%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:** ![jsbonline2006](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jsbonline2006](https://discuss.elastic.co/u/jsbonline2006)\
**Post date:** [January 9, 2014, 8:56am UTC](https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162/2 "2014-01-09T08:56:55Z")

</div>

Also I have another scenario where my index is having words like

software engineer, se, ---\> this should get seached when I do search on  
Software engineer  
team lead, lead, tl ---\> this should get seached when I do search on Team  
Lead

Following are the query to create the records.

curl -XPUT '[http://localhost:9200/employee/test/11?pretty](http://localhost:9200/employee/test/11?pretty)[http://localhost:9200/employee/test/1?pretty](http://localhost:9200/employee/test/1?pretty)'  
-d '{"designation": "software engineer"}'  
curl -XPUT '[http://localhost:9200/employee/test/12?pretty](http://localhost:9200/employee/test/12?pretty)[http://localhost:9200/employee/test/2?pretty](http://localhost:9200/employee/test/2?pretty)'  
-d '{"designation": "se"}'  
curl -XPUT '[http://localhost:9200/employee/test/13?pretty](http://localhost:9200/employee/test/13?pretty)[http://localhost:9200/employee/test/3?pretty](http://localhost:9200/employee/test/3?pretty)'  
-d '{"designation": "sse"}'  
curl -XPUT '[http://localhost:9200/employee/test/14?pretty](http://localhost:9200/employee/test/14?pretty)[http://localhost:9200/employee/test/4?pretty](http://localhost:9200/employee/test/4?pretty)'  
-d '{"designation": "senior software engineer"}'  
curl -XPUT '[http://localhost:9200/employee/test/15?pretty](http://localhost:9200/employee/test/15?pretty)[http://localhost:9200/employee/test/5?pretty](http://localhost:9200/employee/test/5?pretty)'  
-d '{"designation": "team lead"}'  
curl -XPUT '[http://localhost:9200/employee/test/16?pretty&refresh=true](http://localhost:9200/employee/test/16?pretty&refresh=true)[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)'  
-d '{"designation": "tl"}'  
curl -XPUT '[http://localhost:9200/employee/test/17?pretty&refresh=true](http://localhost:9200/employee/test/17?pretty&refresh=true)[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)'  
-d '{"designation": "lead"}'

On Thursday, January 9, 2014 2:12:05 PM UTC+5:30, Jayesh Bhoyar wrote:

> Hi,
> 
> I have following Synonyms that I want to configure.
> 
> software engineer =\> software engineer, se,  
> senior software engineer =\> senior software engineer , see  
> team lead =\> team lead, lead, tl
> 
> So that If I searched for se or Software Engineer it should return me the  
> records having software engineer.
> 
> What mapping I should apply on Designation field? and what query I should  
> fire to get the result....  
> It is possible to use multi\_match query?
> 
> Following are the query to create the records.
> 
> curl -XPUT '[http://localhost:9200/employee/test/1?pretty](http://localhost:9200/employee/test/1?pretty)' -d  
> '{"designation": "software engineer"}'  
> curl -XPUT '[http://localhost:9200/employee/test/2?pretty](http://localhost:9200/employee/test/2?pretty)' -d  
> '{"designation": "software engineer"}'  
> curl -XPUT '[http://localhost:9200/employee/test/3?pretty](http://localhost:9200/employee/test/3?pretty)' -d  
> '{"designation": "senior software engineer"}'  
> curl -XPUT '[http://localhost:9200/employee/test/4?pretty](http://localhost:9200/employee/test/4?pretty)' -d  
> '{"designation": "senior software engineer"}'  
> curl -XPUT '[http://localhost:9200/employee/test/5?pretty](http://localhost:9200/employee/test/5?pretty)' -d  
> '{"designation": "team lead"}'  
> curl -XPUT '[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)' -d  
> '{"designation": "team lead"}'

--  
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/71574363-4a46-4471-be9e-6ef1b0938d60%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/71574363-4a46-4471-be9e-6ef1b0938d60%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:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [January 9, 2014, 3:46pm UTC](https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162/3 "2014-01-09T15:46:49Z")

</div>

He is a little example of query time multi-word synonyms:

> <https://gist.github.com/mattweber/7374591>

Hope this helps.

Thanks,  
Matt Weber

On Thu, Jan 9, 2014 at 12:56 AM, Jayesh Bhoyar [jsbonline2006@gmail.com](mailto:jsbonline2006@gmail.com)wrote:

> Also I have another scenario where my index is having words like
> 
> software engineer, se, ---\> this should get seached when I do search on  
> Software engineer  
> team lead, lead, tl ---\> this should get seached when I do search on Team  
> Lead
> 
> Following are the query to create the records.
> 
> curl -XPUT '[http://localhost:9200/employee/test/11?pretty](http://localhost:9200/employee/test/11?pretty)[http://localhost:9200/employee/test/1?pretty](http://localhost:9200/employee/test/1?pretty)'  
> -d '{"designation": "software engineer"}'  
> curl -XPUT '[http://localhost:9200/employee/test/12?pretty](http://localhost:9200/employee/test/12?pretty)[http://localhost:9200/employee/test/2?pretty](http://localhost:9200/employee/test/2?pretty)'  
> -d '{"designation": "se"}'  
> curl -XPUT '[http://localhost:9200/employee/test/13?pretty](http://localhost:9200/employee/test/13?pretty)[http://localhost:9200/employee/test/3?pretty](http://localhost:9200/employee/test/3?pretty)'  
> -d '{"designation": "sse"}'  
> curl -XPUT '[http://localhost:9200/employee/test/14?pretty](http://localhost:9200/employee/test/14?pretty)[http://localhost:9200/employee/test/4?pretty](http://localhost:9200/employee/test/4?pretty)'  
> -d '{"designation": "senior software engineer"}'  
> curl -XPUT '[http://localhost:9200/employee/test/15?pretty](http://localhost:9200/employee/test/15?pretty)[http://localhost:9200/employee/test/5?pretty](http://localhost:9200/employee/test/5?pretty)'  
> -d '{"designation": "team lead"}'  
> curl -XPUT '[http://localhost:9200/employee/test/16?pretty&refresh=true](http://localhost:9200/employee/test/16?pretty&refresh=true)[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)'  
> -d '{"designation": "tl"}'  
> curl -XPUT '[http://localhost:9200/employee/test/17?pretty&refresh=true](http://localhost:9200/employee/test/17?pretty&refresh=true)[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)'  
> -d '{"designation": "lead"}'
> 
> On Thursday, January 9, 2014 2:12:05 PM UTC+5:30, Jayesh Bhoyar wrote:
> 
> > Hi,
> > 
> > I have following Synonyms that I want to configure.
> > 
> > software engineer =\> software engineer, se,  
> > senior software engineer =\> senior software engineer , see  
> > team lead =\> team lead, lead, tl
> > 
> > So that If I searched for se or Software Engineer it should return me the  
> > records having software engineer.
> > 
> > What mapping I should apply on Designation field? and what query I should  
> > fire to get the result....  
> > It is possible to use multi\_match query?
> > 
> > Following are the query to create the records.
> > 
> > curl -XPUT '[http://localhost:9200/employee/test/1?pretty](http://localhost:9200/employee/test/1?pretty)' -d  
> > '{"designation": "software engineer"}'  
> > curl -XPUT '[http://localhost:9200/employee/test/2?pretty](http://localhost:9200/employee/test/2?pretty)' -d  
> > '{"designation": "software engineer"}'  
> > curl -XPUT '[http://localhost:9200/employee/test/3?pretty](http://localhost:9200/employee/test/3?pretty)' -d  
> > '{"designation": "senior software engineer"}'  
> > curl -XPUT '[http://localhost:9200/employee/test/4?pretty](http://localhost:9200/employee/test/4?pretty)' -d  
> > '{"designation": "senior software engineer"}'  
> > curl -XPUT '[http://localhost:9200/employee/test/5?pretty](http://localhost:9200/employee/test/5?pretty)' -d  
> > '{"designation": "team lead"}'  
> > curl -XPUT '[http://localhost:9200/employee/test/6?pretty&refresh=true](http://localhost:9200/employee/test/6?pretty&refresh=true)'  
> > -d '{"designation": "team lead"}'
> 
> --  
> 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/71574363-4a46-4471-be9e-6ef1b0938d60%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/71574363-4a46-4471-be9e-6ef1b0938d60%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/CAJ3KEoDVd04Mx3Wh1ZEtpgoSeekrhGaGUCCO5Lut%3DnKgdhOGiw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJ3KEoDVd04Mx3Wh1ZEtpgoSeekrhGaGUCCO5Lut%3DnKgdhOGiw%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:** ![jsbonline2006](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@jsbonline2006](https://discuss.elastic.co/u/jsbonline2006)\
**Post date:** [February 5, 2014, 4:40am UTC](https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162/4 "2014-02-05T04:40:31Z")

</div>

Hi Matt,

Thanks for your reply. I have modified your mapping which will suit my  
requirement and add it in Gist

> <https://gist.github.com/jsbonline2006/8817443>

Regards,  
Jayesh Bhoyar  
[http://www.linkedin.com/in/jayeshbhoyar](http://www.linkedin.com/in/jayeshbhoyar)

--  
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/e3fdc576-2028-44bc-98ea-c184a28778eb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e3fdc576-2028-44bc-98ea-c184a28778eb%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, 1:52am UTC](https://discuss.elastic.co/t/how-to-configure-and-implement-synonyms-with-multi-words/15162/5 "2017-07-06T01:52:32Z")

</div>


