Mutiple Keyword/text Search:


(shannu) #1

Hello All,

I am able to perform single keyword search, but unable to achieve the
multiple keyword search:

Single Keyword Search(works fine):
curl -XGET 'http://localhost/index/type/_search?pretty=true' -d '{"query" :
{"text":{"_all":"Shannu"}}}'

or

curl -XGET 'http://localhost/index/type/_search?pretty=true' -d '{"query" :
{"match":{"_all":"Shannu"}}}'

the above query bring back the correct results

Mutiple Keyword/text Search:

curl -XGET 'http://localhost/index/type/_search?pretty=true' -d '{"query" :
{"match":{"_all":["Shannu","
Text2","Something"]}}}' - this query executes with out error but not with
the expected results

Result: {
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

but I am expecting the items or docs which has those keywords I
mentioned..Am I missing something here in the query ?

or is there other way for multiple text search ???

Many thnx in Advance :slight_smile:

Regards,
Shannu.

--


(David Pilato) #2

Why not a match with "Shannu Text2 Something" on _all ?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 oct. 2012 à 12:56, shannu shanmukhaveeranki@gmail.com a écrit :

Shannu","
Text2","Something"

--


(shannu) #3

Thanks a lot David, worked the way I wanted.

I assume that the query operator is OR here:
'{"query" : {"match":{"_all":"Text1 Text2"}}}' - this query brings up all
the results with documents which has Text1 Or Text2 in them.

If in case I had to perform Text1 AND Text2 search, what will be the query ?

Many thanks again.

Cheers,
Shannu.

On Tuesday, October 9, 2012 12:14:13 PM UTC+1, David Pilato wrote:

Why not a match with "Shannu Text2 Something" on _all ?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 oct. 2012 à 12:56, shannu <shanmukh...@gmail.com <javascript:>> a
écrit :

Shannu","
Text2","Something"

--


(David Pilato) #4

You can modify your search "+Text1 +Text2"
or, best, modify the way match query works:
http://www.elasticsearch.org/guide/reference/query-dsl/match-query.html
http://www.elasticsearch.org/guide/reference/query-dsl/match-query.html

{
"match" : {
"message" : {
"query" : "this is a test",
"operator" : "and"
}
}
}

Le 9 octobre 2012 à 13:38, shannu shanmukhaveeranki@gmail.com a écrit :

Thanks a lot David, worked the way I wanted.

I assume that the query operator is OR here:
'{"query" : {"match":{"_all":"Text1 Text2"}}}' - this query brings up all the
results with documents which has Text1 Or Text2 in them.

If in case I had to perform Text1 AND Text2 search, what will be the query ?

Many thanks again.

Cheers,
Shannu.

On Tuesday, October 9, 2012 12:14:13 PM UTC+1, David Pilato wrote:

Why not a match with "Shannu Text2 Something" on _all ?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 oct. 2012 à 12:56, shannu < shanmukh...@gmail.com> a écrit :

Shannu","
Text2","Something"

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--


(shannu) #5

Thanks a Ton David.

U rock :slight_smile:

Cheers,
Shannu.

On Tuesday, October 9, 2012 1:00:32 PM UTC+1, David Pilato wrote:

You can modify your search "+Text1 +Text2"
or, best, modify the way match query works:
http://www.elasticsearch.org/guide/reference/query-dsl/match-query.html

{
"match" : {
"message" : {
"query" : "this is a test",
"operator" : "and"
}
}
}

Le 9 octobre 2012 à 13:38, shannu <shanmukh...@gmail.com <javascript:>> a
écrit :

Thanks a lot David, worked the way I wanted.

I assume that the query operator is OR here:
'{"query" : {"match":{"_all":"Text1 Text2"}}}' - this query brings up all
the results with documents which has Text1 Or Text2 in them.

If in case I had to perform Text1 AND Text2 search, what will be the query
?

Many thanks again.

Cheers,
Shannu.

On Tuesday, October 9, 2012 12:14:13 PM UTC+1, David Pilato wrote:

Why not a match with "Shannu Text2 Something" on _all ?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 9 oct. 2012 à 12:56, shannu < shanmukh...@gmail.com> a écrit :

Shannu","
Text2","Something"

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--


(system) #6