# Is it possible to join multiple search queries with 'OR'?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-join-multiple-search-queries-with-or/54119>\
**Category:** Elasticsearch\
**Created:** [June 28, 2016, 6:57am UTC](https://discuss.elastic.co/t/is-it-possible-to-join-multiple-search-queries-with-or/54119 "2016-06-28T06:57:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![R212](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@R212](https://discuss.elastic.co/u/R212)\
**Post date:** [June 28, 2016, 6:57am UTC](https://discuss.elastic.co/t/is-it-possible-to-join-multiple-search-queries-with-or/54119/1 "2016-06-28T06:57:07Z")

</div>

Hi, thanks for taking the time to read this!

I'm trying to re-create in ElasticSearch the 'OR' statement of SQL databases, something like this:  
SELECT \* FROM table WHERE id = 10 OR name = 'name'

However the queries are way more complicated than that, now my question is, is it possible to have two completely separated search queries that I can join and run them together because if I run them separated I'll have issues for pagination since the results will be shown together.

Search Query 1:  
`{ "query": { "filtered": { "query": { "bool": { "must": [], "must_not": [], "should": [], "minimum_number_should_match": 1 } }, "filter": { "bool": { "must": [{ "terms": { "source_id": [ 118] } } ], "must_not": [] } } } }, "from": 0, "size": 30, "sort": [{ "publication_date": { "order": "desc" } }] }`

Search Query 2:  
`{ "query": { "filtered": { "query": { "bool": { "must": [{ "range": { "publication_date": { "gte": "2016-06-28T00:00:00+00:00", "lte": "2016-06-28T23:59:59+00:00" } } }], "must_not": [], "should": [], "minimum_number_should_match": 1 } }, "filter": { "bool": { "must": [], "must_not": [] } } } }, "from": 0, "size": 30, "sort": [{ "publication_date": { "order": "desc" } }] }`

---

<div class="post-metadata">

**Author:** ![R212](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@R212](https://discuss.elastic.co/u/R212)\
**Post date:** [June 28, 2016, 7:51am UTC](https://discuss.elastic.co/t/is-it-possible-to-join-multiple-search-queries-with-or/54119/2 "2016-06-28T07:51:38Z")

</div>

Never mind, already found the result. if anyone needs something like this however:

`{ "query": { "bool": { "should": [{ "query": ... }, { "query": ... }] } } }`

---

<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:40pm UTC](https://discuss.elastic.co/t/is-it-possible-to-join-multiple-search-queries-with-or/54119/3 "2017-07-05T22:40:02Z")

</div>


