# How to handle a huge query to elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-handle-a-huge-query-to-elasticsearch/143321>\
**Category:** Elasticsearch\
**Created:** [August 7, 2018, 12:22pm UTC](https://discuss.elastic.co/t/how-to-handle-a-huge-query-to-elasticsearch/143321 "2018-08-07T12:22:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![an.secure](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@an.secure](https://discuss.elastic.co/u/an.secure)\
**Post date:** [August 7, 2018, 12:22pm UTC](https://discuss.elastic.co/t/how-to-handle-a-huge-query-to-elasticsearch/143321/1 "2018-08-07T12:22:23Z")

</div>

In order to group the elastic documents in different categories, we have to run some huge queries against elasticsearch. Based on the user input we have to exclude some of the documents that match a criteria. This results in the query becoming very huge. Is there any way we can handle these queries? Any recommendation that can be incorporated in the app to handle such scenarios.

e.g Running multiple search queries and then taking the union / intersection of the response.

---

<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:** [September 4, 2018, 12:22pm UTC](https://discuss.elastic.co/t/how-to-handle-a-huge-query-to-elasticsearch/143321/2 "2018-09-04T12:22:40Z")

</div>

Closed on September 4, 2018, 12:22pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
