How to configure and implement Synonyms with multi words


(jsbonline2006) #1

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' -d
'{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/2?pretty' -d
'{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/3?pretty' -d
'{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/4?pretty' -d
'{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/5?pretty' -d
'{"designation": "team lead"}'
curl -XPUT '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.
To view this discussion on the web visit 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.


(jsbonline2006) #2

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?prettyhttp://localhost:9200/employee/test/1?pretty'
-d '{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/12?prettyhttp://localhost:9200/employee/test/2?pretty'
-d '{"designation": "se"}'
curl -XPUT 'http://localhost:9200/employee/test/13?prettyhttp://localhost:9200/employee/test/3?pretty'
-d '{"designation": "sse"}'
curl -XPUT 'http://localhost:9200/employee/test/14?prettyhttp://localhost:9200/employee/test/4?pretty'
-d '{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/15?prettyhttp://localhost:9200/employee/test/5?pretty'
-d '{"designation": "team lead"}'
curl -XPUT 'http://localhost:9200/employee/test/16?pretty&refresh=truehttp://localhost:9200/employee/test/6?pretty&refresh=true'
-d '{"designation": "tl"}'
curl -XPUT 'http://localhost:9200/employee/test/17?pretty&refresh=truehttp://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' -d
'{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/2?pretty' -d
'{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/3?pretty' -d
'{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/4?pretty' -d
'{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/5?pretty' -d
'{"designation": "team lead"}'
curl -XPUT '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.
To view this discussion on the web visit 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.


(Matt Weber) #3

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

Hope this helps.

Thanks,
Matt Weber

On Thu, Jan 9, 2014 at 12:56 AM, Jayesh Bhoyar jsbonline2006@gmail.comwrote:

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?prettyhttp://localhost:9200/employee/test/1?pretty'
-d '{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/12?prettyhttp://localhost:9200/employee/test/2?pretty'
-d '{"designation": "se"}'
curl -XPUT 'http://localhost:9200/employee/test/13?prettyhttp://localhost:9200/employee/test/3?pretty'
-d '{"designation": "sse"}'
curl -XPUT 'http://localhost:9200/employee/test/14?prettyhttp://localhost:9200/employee/test/4?pretty'
-d '{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/15?prettyhttp://localhost:9200/employee/test/5?pretty'
-d '{"designation": "team lead"}'
curl -XPUT 'http://localhost:9200/employee/test/16?pretty&refresh=truehttp://localhost:9200/employee/test/6?pretty&refresh=true'
-d '{"designation": "tl"}'
curl -XPUT 'http://localhost:9200/employee/test/17?pretty&refresh=truehttp://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' -d
'{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/2?pretty' -d
'{"designation": "software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/3?pretty' -d
'{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/4?pretty' -d
'{"designation": "senior software engineer"}'
curl -XPUT 'http://localhost:9200/employee/test/5?pretty' -d
'{"designation": "team lead"}'
curl -XPUT '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.
To view this discussion on the web visit
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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAJ3KEoDVd04Mx3Wh1ZEtpgoSeekrhGaGUCCO5Lut%3DnKgdhOGiw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(jsbonline2006) #4

Hi Matt,

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

Regards,
Jayesh Bhoyar
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.
To view this discussion on the web visit 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.


(system) #5