# Filter on empty terms

**URL:** <https://discuss.elastic.co/t/filter-on-empty-terms/193116>\
**Category:** Elasticsearch\
**Created:** [July 31, 2019, 12:34pm UTC](https://discuss.elastic.co/t/filter-on-empty-terms/193116 "2019-07-31T12:34:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enzo\_RC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enzo_rc/32/45404_2.png) [@Enzo\_RC](https://discuss.elastic.co/u/Enzo_RC)\
**Post date:** [July 31, 2019, 12:34pm UTC](https://discuss.elastic.co/t/filter-on-empty-terms/193116/1 "2019-07-31T12:34:01Z")

</div>

Hello,

I'm building an app with Dash, i created a checklist, that returns a list of terms. I use that list to filter on my fields. But when there is no filter i don't know how to inform my query to not filter on anything.

here is my query i'm using python:

all\_dep  
all\_domaineA  
all\_typeA

Are the three list i obtain from my dash app. They can be either filled [value,value] or empty []. I'm then wondering if there is any value i could replace my object by, to not filter any value.

```
> res = es.search(
> index="cluster_all", 
> size=10000, 
> body= { "_source": ['geoloc',"societe"],
> "size" : 10000,
> "query": {
> "bool": {
> "must": {
> "match_all": {}
> },
> "filter" : [
> { "terms" : { "num_dep" : all_dep}},
> { "terms" : { "typeA" : all_typeA }},
> { "terms" : { "domaineA" : all_domaineA }}
> ]
> }
> }
> }
> )
```

---

<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:** [August 28, 2019, 12:34pm UTC](https://discuss.elastic.co/t/filter-on-empty-terms/193116/2 "2019-08-28T12:34:06Z")

</div>

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