Near by queries within the boundary of sentences


(reza sadoddin) #1

I want to run near by query so that the terms are not returned as results if they are within two separate sentences. How can I specify this in Elasticsearch?

I am using wikipedia river plugin to index data.
Thanks for sharing your thoughts.

~R


(Ivan Brusic) #2

One solution is to index each sentence individually as a separate instance
of a field. You would need to use the position increment gap setting to
artificially add a large gap between sentences. Then when you search with a
near query, you need to provide a slop less then the gap increment used.

Cheers,

Ivan


(system) #3