# Multiple requests in one query

**URL:** <https://discuss.elastic.co/t/multiple-requests-in-one-query/11569>\
**Category:** Elasticsearch\
**Created:** [April 12, 2013, 6:00pm UTC](https://discuss.elastic.co/t/multiple-requests-in-one-query/11569 "2013-04-12T18:00:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Andhavarapu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_andhavarapu/32/782_2.png) [@Abhishek\_Andhavarapu](https://discuss.elastic.co/u/Abhishek_Andhavarapu)\
**Post date:** [April 12, 2013, 6:00pm UTC](https://discuss.elastic.co/t/multiple-requests-in-one-query/11569/1 "2013-04-12T18:00:26Z")

</div>

Hi all,

I was wondering if I can pass multiple queries in single requests. I'm  
trying to compute a table using elastic search. I have to execute 100  
queries separately to fill up the table. Thats lots of network I/0 instead  
I'm wondering If i can pass multiple queries in one request.

Like

{

- query: {
  - bool: {
    - must: [
      - {
        - term: {
          - type.listA: a  
}  
}

      - {
        - term: {
          - type.listA: b  
}  
}  
]

    - 

}  
}

- 

},

{

- query: {
  - bool: {
    - must: [
      - {
        - term: {
          - type.listA: d  
}  
}

      - {
        - term: {
          - type.listA: e  
}  
}  
]

    - 

}  
}

- 

}

Thanks

--  
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:** [April 12, 2013, 6:01pm UTC](https://discuss.elastic.co/t/multiple-requests-in-one-query/11569/2 "2013-04-12T18:01:46Z")

</div>

Have a look at: [http://www.elasticsearch.org/guide/reference/api/multi-search/](http://www.elasticsearch.org/guide/reference/api/multi-search/)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 12 avr. 2013 à 20:00, Abhishek Andhavarapu [abhishek376@gmail.com](mailto:abhishek376@gmail.com) a écrit :

> Hi all,
> 
> I was wondering if I can pass multiple queries in single requests. I'm trying to compute a table using Elasticsearch. I have to execute 100 queries separately to fill up the table. Thats lots of network I/0 instead I'm wondering If i can pass multiple queries in one request.
> 
> Like
> 
> {  
> query: {  
> bool: {  
> must: [  
> {  
> term: {  
> type.listA: a  
> }  
> }  
> {  
> term: {  
> type.listA: b  
> }  
> }  
> ]
> 
> }  
> }
> 
> },
> 
> {  
> query: {  
> bool: {  
> must: [  
> {  
> term: {  
> type.listA: d  
> }  
> }  
> {  
> term: {  
> type.listA: e  
> }  
> }  
> ]
> 
> }  
> }
> 
> }
> 
> Thanks
> 
> --  
> 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:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 15, 2013, 6:44am UTC](https://discuss.elastic.co/t/multiple-requests-in-one-query/11569/3 "2013-04-15T06:44:34Z")

</div>

Hey,

just a note about your network I/O. It might make sense not to put 100  
requests in one multi search request, because the slowest of these queries  
will determine the total response time of your request and slow down all  
others. Please check out your HTTP connection library if it supports HTTP  
Keep Alive, so you can save the overhead of creating new TCP connections  
and 'only' have the HTTP overhead per request (which is ok in most cases).  
Also, do some performance tests if your HTTP client library maybe slow at  
special circumstances and if it makes sense to replace...

--Alex

On Fri, Apr 12, 2013 at 8:01 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Have a look at:  
> [http://www.elasticsearch.org/guide/reference/api/multi-search/](http://www.elasticsearch.org/guide/reference/api/multi-search/)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 12 avr. 2013 à 20:00, Abhishek Andhavarapu [abhishek376@gmail.com](mailto:abhishek376@gmail.com) a  
> écrit :
> 
> Hi all,
> 
> I was wondering if I can pass multiple queries in single requests. I'm  
> trying to compute a table using Elasticsearch. I have to execute 100  
> queries separately to fill up the table. Thats lots of network I/0 instead  
> I'm wondering If i can pass multiple queries in one request.
> 
> Like
> 
> {
> 
> - query: {
> - bool: {
> - must: [
> - {
> - term: {
> - type.listA: a  
> }  
> }
> 
> - {
> - term: {
> - type.listA: b  
> }  
> }  
> ]
> 
> - 
> 
> }  
> }
> 
> - 
> 
> },
> 
> {
> 
> - query: {
> - bool: {
> - must: [
> - {
> - term: {
> - type.listA: d  
> }  
> }
> 
> - {
> - term: {
> - type.listA: e  
> }  
> }  
> ]
> 
> - 
> 
> }  
> }
> 
> - 
> 
> }
> 
> Thanks
> 
> --  
> 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).

--  
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:41am UTC](https://discuss.elastic.co/t/multiple-requests-in-one-query/11569/4 "2017-07-06T02:41:09Z")

</div>


