# It is possible to execute only one query out of three?

**URL:** <https://discuss.elastic.co/t/it-is-possible-to-execute-only-one-query-out-of-three/217900>\
**Category:** Elasticsearch\
**Created:** [February 5, 2020, 4:52am UTC](https://discuss.elastic.co/t/it-is-possible-to-execute-only-one-query-out-of-three/217900 "2020-02-05T04:52:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek.tripathi](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@abhishek.tripathi](https://discuss.elastic.co/u/abhishek.tripathi)\
**Post date:** [February 5, 2020, 4:52am UTC](https://discuss.elastic.co/t/it-is-possible-to-execute-only-one-query-out-of-three/217900/1 "2020-02-05T04:52:45Z")

</div>

Hi Everyone,

I need a way to execute one query out of three. if any query executes successfully then other two queries must escape from execution.

Like:

if( a==10 OR a ==20){  
}  
else if( a==30 OR a ==40){  
}  
else if( a==50 OR a ==60){  
}

is it possible to achieve in elastic search to built a search query like this?

---

<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:** [February 5, 2020, 9:47am UTC](https://discuss.elastic.co/t/it-is-possible-to-execute-only-one-query-out-of-three/217900/2 "2020-02-05T09:47:10Z")

</div>

That is not possible. How about executing a [multisearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-multi-search.html) query instead and pick the query which has any results?

---

<div class="post-metadata">

**Author:** ![abhishek.tripathi](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@abhishek.tripathi](https://discuss.elastic.co/u/abhishek.tripathi)\
**Post date:** [February 6, 2020, 6:00am UTC](https://discuss.elastic.co/t/it-is-possible-to-execute-only-one-query-out-of-three/217900/3 "2020-02-06T06:00:30Z")

</div>

Thanks @spinscale

---

<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:** [March 5, 2020, 6:00am UTC](https://discuss.elastic.co/t/it-is-possible-to-execute-only-one-query-out-of-three/217900/4 "2020-03-05T06:00:41Z")

</div>

Closed on March 5, 2020, 6:00am UTC

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