# Python elasticsearch\_dsl search problem

**URL:** <https://discuss.elastic.co/t/python-elasticsearch-dsl-search-problem/142413>\
**Category:** Elasticsearch\
**Created:** [July 31, 2018, 4:21pm UTC](https://discuss.elastic.co/t/python-elasticsearch-dsl-search-problem/142413 "2018-07-31T16:21:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hartleyjr](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@hartleyjr](https://discuss.elastic.co/u/hartleyjr)\
**Post date:** [July 31, 2018, 4:21pm UTC](https://discuss.elastic.co/t/python-elasticsearch-dsl-search-problem/142413/1 "2018-07-31T16:21:34Z")

</div>

I'm trying to perform the following search but the exclude part (line 5) is not working. The goal is to exclude all results where field "geoip.country\_name" contains "United States" (so I want all results from all other countries). Is this possible?

s = Search(using=client, index="filebeat-exchange-\*")   
.query("match", type="iis").extra(size=0)   
.filter("range", \*\* {'@timestamp': {'gte': 'now-61m', 'lt': 'now'}})   
.filter("match", \*\* {"sc-status": "200"})   
.exclude("match", \*\* { "geoip.country\_name": "United States"})

---

<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, 2018, 4:21pm UTC](https://discuss.elastic.co/t/python-elasticsearch-dsl-search-problem/142413/2 "2018-08-28T16:21:40Z")

</div>

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