Query for contains


(Kartavya) #1

Hi All,
I want to write a percolate query that match the document containing the
term as sub-string.

like a contains query.
Example:
a document in index like filed1:"dtfinanace"

must be returned in result if I search for "fields:"finance".

Any help will be highly appreciated.

Thnaks,
Pulkit Agrawal


(ppearcy) #2

While you could do wildcard queries, I don't believe they are very
efficient. I'd recommend using an n-gram analyzer:
http://search.lucidimagination.com/search/document/CDRG_ch05_5.5.5
http://www.elasticsearch.org/guide/reference/index-modules/analysis/ngram-tokenizer.html

Best Regards,
Paul

On Aug 8, 3:04 pm, Pulkit Agrawal pulkitdot...@gmail.com wrote:

Hi All,
I want to write a percolate query that match the document containing the
term as sub-string.

like a contains query.
Example:
a document in index like filed1:"dtfinanace"

must be returned in result if I search for "fields:"finance".

Any help will be highly appreciated.

Thnaks,
Pulkit Agrawal


(Kartavya) #3

Thanks Paul,

I will try that.
Does it work in percolate as well?

Regards,
Pulkit Agrawal

On Tue, Aug 9, 2011 at 3:05 AM, ppearcy ppearcy@gmail.com wrote:

While you could do wildcard queries, I don't believe they are very
efficient. I'd recommend using an n-gram analyzer:
http://search.lucidimagination.com/search/document/CDRG_ch05_5.5.5

http://www.elasticsearch.org/guide/reference/index-modules/analysis/ngram-tokenizer.html

Best Regards,
Paul

On Aug 8, 3:04 pm, Pulkit Agrawal pulkitdot...@gmail.com wrote:

Hi All,
I want to write a percolate query that match the document containing the
term as sub-string.

like a contains query.
Example:
a document in index like filed1:"dtfinanace"

must be returned in result if I search for "fields:"finance".

Any help will be highly appreciated.

Thnaks,
Pulkit Agrawal


(ppearcy) #4

Yeah, you should be able to save and percolate any query that you can
run through the search APIs.

Regards,
Paul

On Aug 9, 12:02 pm, Pulkit Agrawal pulkitdot...@gmail.com wrote:

Thanks Paul,

I will try that.
Does it work in percolate as well?

Regards,
Pulkit Agrawal

On Tue, Aug 9, 2011 at 3:05 AM, ppearcy ppea...@gmail.com wrote:

While you could do wildcard queries, I don't believe they are very
efficient. I'd recommend using an n-gram analyzer:
http://search.lucidimagination.com/search/document/CDRG_ch05_5.5.5

http://www.elasticsearch.org/guide/reference/index-modules/analysis/n...

Best Regards,
Paul

On Aug 8, 3:04 pm, Pulkit Agrawal pulkitdot...@gmail.com wrote:

Hi All,
I want to write a percolate query that match the document containing the
term as sub-string.

like a contains query.
Example:
a document in index like filed1:"dtfinanace"

must be returned in result if I search for "fields:"finance".

Any help will be highly appreciated.

Thnaks,
Pulkit Agrawal


(system) #5