# Mixing different queries (term, nested, query\_string) to query the index

**URL:** <https://discuss.elastic.co/t/mixing-different-queries-term-nested-query-string-to-query-the-index/14224>\
**Category:** Elasticsearch\
**Created:** [November 1, 2013, 6:45pm UTC](https://discuss.elastic.co/t/mixing-different-queries-term-nested-query-string-to-query-the-index/14224 "2013-11-01T18:45:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramdev\_Wudali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramdev_wudali/32/7894_2.png) [@Ramdev\_Wudali](https://discuss.elastic.co/u/Ramdev_Wudali)\
**Post date:** [November 1, 2013, 6:45pm UTC](https://discuss.elastic.co/t/mixing-different-queries-term-nested-query-string-to-query-the-index/14224/1 "2013-11-01T18:45:31Z")

</div>

Hi:  
I have a document that is mapped with certain fields being nested  
fields. I have use cases where I get a request which when translated  
becomes  
a mix of nested and query\_string queries. (or nested, term and query\_string  
queries).

Is there a way to mix the queries ?

I am aware that a term query or a query\_string can have a filter which is a  
nested query or vice-versa. This begs the question :

Conceptually , Is a a query like so : Term:value AND query\_string  
the same as executing a Term:value query with a filter of query\_string ?

Similarly for nested queries ?

Thanks for any assistance regarding this

Ramdev

--  
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:** ![sina\_tamanna](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@sina\_tamanna](https://discuss.elastic.co/u/sina_tamanna)\
**Post date:** [November 4, 2013, 8:02am UTC](https://discuss.elastic.co/t/mixing-different-queries-term-nested-query-string-to-query-the-index/14224/2 "2013-11-04T08:02:10Z")

</div>

One way to mix queries is to use bool query[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)  
.

On Friday, November 1, 2013 7:45:31 PM UTC+1, Ramdev Wudali wrote:

> Hi:  
> I have a document that is mapped with certain fields being nested  
> fields. I have use cases where I get a request which when translated  
> becomes  
> a mix of nested and query\_string queries. (or nested, term and  
> query\_string queries).
> 
> Is there a way to mix the queries ?
> 
> I am aware that a term query or a query\_string can have a filter which is  
> a nested query or vice-versa. This begs the question :
> 
> Conceptually , Is a a query like so : Term:value AND query\_string  
> the same as executing a Term:value query with a filter of query\_string ?
> 
> Similarly for nested queries ?
> 
> Thanks for any assistance regarding this
> 
> Ramdev

--  
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:09am UTC](https://discuss.elastic.co/t/mixing-different-queries-term-nested-query-string-to-query-the-index/14224/3 "2017-07-06T02:09:06Z")

</div>


