# Passing nested boolean search filters using tire or otherwise

**URL:** <https://discuss.elastic.co/t/passing-nested-boolean-search-filters-using-tire-or-otherwise/8720>\
**Category:** Elasticsearch\
**Created:** [August 11, 2012, 10:19pm UTC](https://discuss.elastic.co/t/passing-nested-boolean-search-filters-using-tire-or-otherwise/8720 "2012-08-11T22:19:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![azitabh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azitabh/32/2647_2.png) [@azitabh](https://discuss.elastic.co/u/azitabh)\
**Post date:** [August 11, 2012, 10:19pm UTC](https://discuss.elastic.co/t/passing-nested-boolean-search-filters-using-tire-or-otherwise/8720/1 "2012-08-11T22:19:36Z")

</div>

I have some requirement that can't be met by a combination of should, must  
and must\_not and requires further and/or between the result sets fetched by  
these combination.  
A sample case:  
Lets say my my document stores some kind of a rule with the following  
structure:

id:1,  
a:{  
in:{  
list:[],  
group:[],  
prefix:[]  
},  
not\_in:{  
list:[],  
group:[],  
prefix:[]  
},  
b:{  
in:{  
list:[],  
group:[],  
prefix:[]  
},  
not\_in:{  
list:[],  
group:[],  
prefix:[]  
}

These arrays contain a list of values.

Given a duplet a and b, i have to this against the indexed rules. So a  
combination of should, must and must not can give me results matching  
either a or b... but what i want in my result set is rules matching both a  
and b... is this possible... i am using the ruby gem tire to frame these  
queries... so it would be helpful if someone can post a reply using in tire  
query format... a general json query to be posted to elastic search is also  
welcome.

Thanks in advance  
-Azitabh

--

---

<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 6, 2017, 3:16am UTC](https://discuss.elastic.co/t/passing-nested-boolean-search-filters-using-tire-or-otherwise/8720/2 "2017-07-06T03:16:42Z")

</div>


