Search Order of term in query


(Kartavya) #1

Hi All,

if I search for "UK Equity", there is a specific order to the phrase.

Your result will have to return like "XXXXXX UK XXXXX Equity" but not
"XXXXX Equity XXXX UK"

How I can implement this in elastic search?

Please suggest.

Thanks,
Pulkit Agrawal


(Shay Banon) #2

you can use text query with text phrase type, possibly using a higher than
0 slop value (
http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html),
which means how far terms within the phrase can be "apart".

On Sun, Apr 8, 2012 at 2:08 PM, Pulkit Agrawal pulkitdotcom@gmail.comwrote:

Hi All,

if I search for "UK Equity", there is a specific order to the phrase.

Your result will have to return like "XXXXXX UK XXXXX Equity" but not
"XXXXX Equity XXXX UK"

How I can implement this in elastic search?

Please suggest.

Thanks,
Pulkit Agrawal


(system) #3