Elasticsearch DSL with (A or B) and C

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?

That looks correct to me.

Could you provide a full recreation script as described in About the Elasticsearch category. 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.

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