LIKE Query


(Pavan BNV) #1

Hi All,

Is there any way to find documents by querying fields for matching terms similar to database LIKE
I have gone thru some of the queries which are dated 2012, 2011. None of them has straightforward answer. Not sure of we have the feature in current version 1.4.5

I want some thing like ...

Actual data : Field1 : Something similar to this

My queries : "omething simi"
,"ilar to thi" should be able to retrieve the document.

Can anyone let me know how to achieve this??


(David Pilato) #2

You need first to understand that a search engine is not a SQL like system.
It’s based on a inverted index so what you query is not your source data but the index you have created.

The way you build your index is extremely important then.
You could imagine using wildcard queries but first it would inefficient and it would require that instead of indexing tokens you index full sentences.

I suggest that you first read this chapter (go through all sections): http://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-analysis.html http://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-analysis.html

Answering to your question, using ngrams would probably help here.

Hope this helps

--
David Pilato - Developer | Evangelist
elastic.co
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 30 avr. 2015 à 14:10, pavanbnv pavan.bnv@gmail.com a écrit :

Hi All,

Is there any way to find documents by querying fields for matching terms
similar to database LIKE
I have gone thru some of the queries which are dated 2012, 2011. None of
them has straightforward answer. Not sure of we have the feature in current
version 1.4.5

I want some thing like ...

Actual data : Field1 : Something similar to this

My queries : "omething simi"
,"ilar to thi" should be able to retrieve the document.

Can anyone let me know how to achieve this??

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/LIKE-Query-tp4074378.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

--
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/1430395818238-4074378.post%40n3.nabble.com.
For more options, visit https://groups.google.com/d/optout.

--
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/3199B348-31DB-47A8-9E67-64994E8AD364%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(system) #3