# Execute subquery if another one does not return result

**URL:** <https://discuss.elastic.co/t/execute-subquery-if-another-one-does-not-return-result/48687>\
**Category:** Elasticsearch\
**Created:** [April 28, 2016, 2:09pm UTC](https://discuss.elastic.co/t/execute-subquery-if-another-one-does-not-return-result/48687 "2016-04-28T14:09:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eprst](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@eprst](https://discuss.elastic.co/u/eprst)\
**Post date:** [April 28, 2016, 2:09pm UTC](https://discuss.elastic.co/t/execute-subquery-if-another-one-does-not-return-result/48687/1 "2016-04-28T14:09:05Z")

</div>

I have a 2 stage document detection query. one is strong and fast (just comparing one untokenized field) another one is more complex it includes sript filter and multi\_match query and it is weaker. thatswhy I wonder can i somehow combine them in single request but execute 2 only if first one found nothing?

---

<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 5, 2017, 10:55pm UTC](https://discuss.elastic.co/t/execute-subquery-if-another-one-does-not-return-result/48687/2 "2017-07-05T22:55:32Z")

</div>

Closed on July 5, 2017, 10:55pm UTC


