Search string with space


(ElasticUser) #1

In my raw message, I have apache directory text. I am using term query as below
.setQuery(termQuery("message", ""apache directory""))
But get 0 hits.
Can someone let me know the API for matching strings separated by space? Please suggest....need solution urgently. Thanks


(David Pilato) #2

You have to change your analyzer for this field.
By default, strings are tokenized into terms.

David :wink:

Le 5 août 2011 à 16:09, ElasticUser lkodwaney@gmail.com a écrit :

In my raw message, I have apache directory text. I am using term query as
below
.setQuery(termQuery("message", ""apache directory""))
But get 0 hits.
Can someone let me know the API for matching strings separated by space?
Please suggest....need solution urgently. Thanks

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/search-string-with-space-tp3228790p3228790.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(ppearcy) #3

Or you can use a different query type to do a phrase search. I know
query string query will work:
http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html

or a text phrase query should work:
http://www.elasticsearch.org/guide/reference/query-dsl/text-query.html

Best Regards,
Paul

On Aug 6, 12:41 pm, David Pilato da...@pilato.fr wrote:

You have to change your analyzer for this field.
By default, strings are tokenized into terms.

David :wink:

Le 5 août 2011 à 16:09, ElasticUser lkodwa...@gmail.com a écrit :

In my raw message, I have apache directory text. I am using term query as
below
.setQuery(termQuery("message", ""apache directory""))
But get 0 hits.
Can someone let me know the API for matching strings separated by space?
Please suggest....need solution urgently. Thanks

--
View this message in context:http://elasticsearch-users.115913.n3.nabble.com/search-string-with-sp...
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #4