# ElasticSearch also returns queries

**URL:** <https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626>\
**Category:** Elasticsearch\
**Created:** [July 2, 2013, 7:46pm UTC](https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626 "2013-07-02T19:46:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wei\_Sun](https://avatars.discourse-cdn.com/v4/letter/w/a183cd/32.png) [@Wei\_Sun](https://discuss.elastic.co/u/Wei_Sun)\
**Post date:** [July 2, 2013, 7:46pm UTC](https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626/1 "2013-07-02T19:46:45Z")

</div>

Dear All, I use ES to query "TermA OR TermB", and get a lot of results. I  
wonder how to configure ES so that I can figure out which results contain "  
TermA" only, which contain "TermB" only, and which contain "TermA" and  
"TermB".

Wei

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 2, 2013, 10:23pm UTC](https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626/2 "2013-07-02T22:23:10Z")

</div>

May be the MultiSearch API could help here?

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

Le 2 juil. 2013 à 21:46, Wei Sun [sunwei317@gmail.com](mailto:sunwei317@gmail.com) a écrit :

> Dear All, I use ES to query "TermA OR TermB", and get a lot of results. I wonder how to configure ES so that I can figure out which results contain " TermA" only, which contain "TermB" only, and which contain "TermA" and "TermB".
> 
> ## Wei
> 
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [July 3, 2013, 9:27am UTC](https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626/3 "2013-07-03T09:27:37Z")

</div>

You can run multiple queries, even on the same search request as David  
mentioned using the multi search api[http://www.elasticsearch.org/guide/reference/api/multi-search/](http://www.elasticsearch.org/guide/reference/api/multi-search/).  
You could also have a look at named filters[http://www.elasticsearch.org/guide/reference/api/search/named-filters/](http://www.elasticsearch.org/guide/reference/api/search/named-filters/):  
you can basically assing a name to each filter and get back for each hit  
which filters it matched.

On Wednesday, July 3, 2013 12:23:10 AM UTC+2, David Pilato wrote:

> May be the MultiSearch API could help here?
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 2 juil. 2013 à 21:46, Wei Sun \<[sunw...@gmail.com](mailto:sunw...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Dear All, I use ES to query "TermA OR TermB", and get a lot of results. I  
> wonder how to configure ES so that I can figure out which results contain "  
> TermA" only, which contain "TermB" only, and which contain "TermA" and  
> "TermB".
> 
> Wei
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Wei\_Sun](https://avatars.discourse-cdn.com/v4/letter/w/a183cd/32.png) [@Wei\_Sun](https://discuss.elastic.co/u/Wei_Sun)\
**Post date:** [July 3, 2013, 3:05pm UTC](https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626/4 "2013-07-03T15:05:20Z")

</div>

Thank you, David and Luca!

wei

On Tuesday, July 2, 2013 3:46:45 PM UTC-4, Wei Sun wrote:

> Dear All, I use ES to query "TermA OR TermB", and get a lot of results. I  
> wonder how to configure ES so that I can figure out which results contain "  
> TermA" only, which contain "TermB" only, and which contain "TermA" and  
> "TermB".
> 
> Wei

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:28am UTC](https://discuss.elastic.co/t/elasticsearch-also-returns-queries/12626/5 "2017-07-06T02:28:24Z")

</div>


