Passing nested boolean search filters using tire or otherwise

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

--