# Elasticsearch DSL with (A or B) and C

**URL:** <https://discuss.elastic.co/t/elasticsearch-dsl-with-a-or-b-and-c/222890>\
**Category:** Elasticsearch\
**Created:** [March 10, 2020, 9:03am UTC](https://discuss.elastic.co/t/elasticsearch-dsl-with-a-or-b-and-c/222890 "2020-03-10T09:03:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tennis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tennis/32/47746_2.png) [@Tennis](https://discuss.elastic.co/u/Tennis)\
**Post date:** [March 10, 2020, 9:03am UTC](https://discuss.elastic.co/t/elasticsearch-dsl-with-a-or-b-and-c/222890/1 "2020-03-10T09:03:02Z")

</div>

I want to query the data with the condition:  
**("product":"book" OR customer":"A") AND "Tag":"T1"**

My DSL:

```
body = {
    "query":{
        "bool":{
            "must":[
				{"bool":{
					"should":[
						{
							"match":{
								"product":"book"
							}
						},
						{
							"match":{
								"customer":"A"
							}
						}
					]
				}},
				{
					"match":{
						"Tag":"T1"
					}
				}
			]
        }
    }
}

```

It seems not to work. How to correct it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 10, 2020, 9:29am UTC](https://discuss.elastic.co/t/elasticsearch-dsl-with-a-or-b-and-c/222890/2 "2020-03-10T09:29:19Z")

</div>

That looks correct to me.

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<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 7, 2020, 9:38am UTC](https://discuss.elastic.co/t/elasticsearch-dsl-with-a-or-b-and-c/222890/3 "2020-04-07T09:38:06Z")

</div>

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