# Many queries with one mega function or many functions?

**URL:** <https://discuss.elastic.co/t/many-queries-with-one-mega-function-or-many-functions/117722>\
**Category:** Elasticsearch\
**Created:** [January 31, 2018, 12:12am UTC](https://discuss.elastic.co/t/many-queries-with-one-mega-function-or-many-functions/117722 "2018-01-31T00:12:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pisush](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pisush/32/25568_2.png) [@Pisush](https://discuss.elastic.co/u/Pisush)\
**Post date:** [January 31, 2018, 12:12am UTC](https://discuss.elastic.co/t/many-queries-with-one-mega-function-or-many-functions/117722/1 "2018-01-31T00:12:45Z")

</div>

Using an elastic client for doing different queries -  
is it better to run them all through the same mega-function that does all possible processing, like applying filters (sometimes those values are empty so only part of the processing steps are taken) and queries against ES, or make a separate query function for each query or group of queries?

Thanks

---

<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:** [February 28, 2018, 12:13am UTC](https://discuss.elastic.co/t/many-queries-with-one-mega-function-or-many-functions/117722/2 "2018-02-28T00:13:03Z")

</div>

Closed on February 28, 2018, 12:13am UTC

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