# Elasticsearch query - AND doesn't return values (when I know it should)

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-and-doesnt-return-values-when-i-know-it-should/56818>\
**Category:** Elasticsearch\
**Created:** [July 31, 2016, 11:00am UTC](https://discuss.elastic.co/t/elasticsearch-query-and-doesnt-return-values-when-i-know-it-should/56818 "2016-07-31T11:00:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benyamin\_Dvoskin](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@Benyamin\_Dvoskin](https://discuss.elastic.co/u/Benyamin_Dvoskin)\
**Post date:** [July 31, 2016, 11:00am UTC](https://discuss.elastic.co/t/elasticsearch-query-and-doesnt-return-values-when-i-know-it-should/56818/1 "2016-07-31T11:00:24Z")

</div>

I try to get data from elasticsearch with the exact filtering that I have on a Kibana3 dashboard, and for some reason can't make it make sense.

this is what I have on Kibana (which returns docs):

 ![](https://us1.discourse-cdn.com/elastic/original/2X/4/495e3b40833979d098753660b204817fec905bcc.PNG)

and this is a query that I try to run against ES and get no results:

```
{
"query": {
    "filtered": {
        "query": {
            "match_all": {}
        },
        "filter": {
            "bool" : {
                "must" : [
                    { "term" : { "domain_name.raw": "foo.bar" } },
                    { "term" : { "method": "get" } }
                ],
                "should" : {
                    "or" : [
                            {
                                "term" : { "pathname.raw" : "/xxxxx" }
                            },
                            {
                                "term" : { "pathname.raw" : "/yyyyy" }
                            },
                            {
                                "term" : { "pathname.raw" : "/zzzzz" }
                            }
                    ]
                }
            }
        }
    }
}
}

```

I've been cracking my head on it for a few hours and can't get it to work. when I remove one of the must terms (either the domain\_name or the method), I do get results. but then I'ts not exactly the filtering I need... any idea where i'm going wrong?

---

<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:** [July 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/elasticsearch-query-and-doesnt-return-values-when-i-know-it-should/56818/2 "2017-07-05T22:31:27Z")

</div>


