# Combining filters

**URL:** <https://discuss.elastic.co/t/combining-filters/110824>\
**Category:** Elasticsearch\
**Created:** [December 8, 2017, 10:33am UTC](https://discuss.elastic.co/t/combining-filters/110824 "2017-12-08T10:33:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ihor\_Luhovyi](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@Ihor\_Luhovyi](https://discuss.elastic.co/u/Ihor_Luhovyi)\
**Post date:** [December 8, 2017, 10:33am UTC](https://discuss.elastic.co/t/combining-filters/110824/1 "2017-12-08T10:33:44Z")

</div>

Hello.  
How can i use 'must' with nested 'should' and nested 'must '?  
like Select \* ...Where (domainId AND projectId AND (( data\_range AND userid) OR ( data\_range AND userid) )  
{  
"bool" : {  
"must" : [  
{  
"term" : {  
"domainId" : {  
"value" : 7,  
"boost" : 1.0  
}  
}  
},  
{  
"bool" : {  
"should" : [  
{  
"bool" : {  
"must" : [  
{  
"range" : {  
"date" : {  
"from" : "2017-12-05",  
"to" : "2017-12-05",  
"include\_lower" : true,  
"include\_upper" : true,  
"format" : "yyyy-MM-dd",  
"boost" : 1.0  
}  
}  
}  
],  
"disable\_coord" : false,  
"adjust\_pure\_negative" : true,  
"boost" : 1.0  
}  
}  
],  
"disable\_coord" : false,  
"adjust\_pure\_negative" : true,  
"boost" : 1.0  
}  
},  
{  
"bool" : {  
"should" : [  
{  
"bool" : {  
"must" : [  
{  
"range" : {  
"date" : {  
"from" : "2017-12-06",  
"to" : "2017-12-06",  
"include\_lower" : true,  
"include\_upper" : true,  
"format" : "yyyy-MM-dd",  
"boost" : 1.0  
}  
}  
}  
],  
"disable\_coord" : false,  
"adjust\_pure\_negative" : true,  
"boost" : 1.0  
}  
}  
],  
"disable\_coord" : false,  
"adjust\_pure\_negative" : true,  
"boost" : 1.0  
}  
}  
],  
"disable\_coord" : false,  
"adjust\_pure\_negative" : true,  
"boost" : 1.0  
}  
}

---

<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:** [January 5, 2018, 10:34am UTC](https://discuss.elastic.co/t/combining-filters/110824/2 "2018-01-05T10:34:10Z")

</div>

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