# Mutiple Keyword/text Search:

**URL:** <https://discuss.elastic.co/t/mutiple-keyword-text-search/9287>\
**Category:** Elasticsearch\
**Created:** [October 9, 2012, 10:56am UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287 "2012-10-09T10:56:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shannu](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shannu](https://discuss.elastic.co/u/shannu)\
**Post date:** [October 9, 2012, 10:56am UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287/1 "2012-10-09T10:56:34Z")

</div>

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](http://localhost/index/type/_search?pretty=true)' -d '{"query" :  
{"text":{"\_all":"Shannu"}}}'

or

curl -XGET '[http://localhost/index/type/\_search?pretty=true](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](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 🙂

Regards,  
Shannu.

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 9, 2012, 11:14am UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287/2 "2012-10-09T11:14:01Z")

</div>

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

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

Le 9 oct. 2012 à 12:56, shannu [shanmukhaveeranki@gmail.com](mailto:shanmukhaveeranki@gmail.com) a écrit :

> Shannu","  
> Text2","Something"

--

---

<div class="post-metadata">

**Author:** ![shannu](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shannu](https://discuss.elastic.co/u/shannu)\
**Post date:** [October 9, 2012, 11:38am UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287/3 "2012-10-09T11:38:35Z")

</div>

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 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 9 oct. 2012 à 12:56, shannu \<[shanmukh...@gmail.com](mailto:shanmukh...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> > Shannu","  
> > Text2","Something"

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 9, 2012, 12:00pm UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287/4 "2012-10-09T12:00:24Z")

</div>

You can modify your search "+Text1 +Text2"  
or, best, modify the way match query works:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/match-query.html)  
[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](mailto: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 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 9 oct. 2012 à 12:56, shannu \< [shanmukh...@gmail.com](mailto:shanmukh...@gmail.com)\> a écrit :
> > 
> > > Shannu","  
> > > Text2","Something"
> 
> --

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

--

---

<div class="post-metadata">

**Author:** ![shannu](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@shannu](https://discuss.elastic.co/u/shannu)\
**Post date:** [October 9, 2012, 1:41pm UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287/5 "2012-10-09T13:41:19Z")

</div>

Thanks a Ton David.

U rock 🙂

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:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](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](mailto: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 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 9 oct. 2012 à 12:56, shannu \< [shanmukh...@gmail.com](mailto:shanmukh...@gmail.com)\> a écrit :
> 
> > Shannu","  
> > Text2","Something"
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:09am UTC](https://discuss.elastic.co/t/mutiple-keyword-text-search/9287/6 "2017-07-06T03:09:36Z")

</div>


