# Combine queries with "missing" filter

**URL:** <https://discuss.elastic.co/t/combine-queries-with-missing-filter/79519>\
**Category:** Elasticsearch\
**Created:** [March 21, 2017, 10:06pm UTC](https://discuss.elastic.co/t/combine-queries-with-missing-filter/79519 "2017-03-21T22:06:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![teteu](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@teteu](https://discuss.elastic.co/u/teteu)\
**Post date:** [March 21, 2017, 10:06pm UTC](https://discuss.elastic.co/t/combine-queries-with-missing-filter/79519/1 "2017-03-21T22:06:33Z")

</div>

Hey guys, I'm just wondering why the first example works, and the second doesn't? What am I missing there? [https://gist.github.com/matcouto/a8778cb21e3d8da73e79da3b8914f23a](https://gist.github.com/matcouto/a8778cb21e3d8da73e79da3b8914f23a)  
######### This works ##########  
{  
"query": {  
"bool": {  
"must": [  
{  
"constant\_score": {  
"filter": {  
"missing": {  
"field": "given\_name"  
}  
}  
}  
},  
{  
"wildcard": {  
"family\_name": "_hen_"  
}  
}  
]  
}  
}  
}

######### This doesn't work ##########  
"query": {  
"bool": {  
"must": [  
{  
"constant\_score": {  
"filter": {  
"missing": {  
"field": "given\_name"  
}  
}  
}  
},  
{  
"terms": {  
"status": [  
"Active"  
]  
}  
}  
]  
}  
}

Is this a good approach for combining queries and 'missing' filter? I just want to be able to search by null values while also adding new constraints

Thanks in advance

---

<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:** [April 18, 2017, 10:06pm UTC](https://discuss.elastic.co/t/combine-queries-with-missing-filter/79519/2 "2017-04-18T22:06:33Z")

</div>

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