我需要一个elasticsearch查询,但它必须包含多个where和orwhere子句,如下所示;
SELECT * FROM pictures WHERE((width = 400 AND height = 300)OR(width = 800 AND height = 600))AND status = 1 AND deleted = 0
谢谢。
答案 0 :(得分:0)
使用此查询
{
"query": {
"bool": {
"must": [
{
"match": {
"status": 1
}
},
{
"match": {
"deleted": 0
}
}
],
"should": [
{
"bool": {
"must": [
{
"match": {
"width": "400"
}
},
{
"match": {
"height": "300"
}
}
]
}
},
{
"bool": {
"must": [
{
"match": {
"width": "800"
}
},
{
"match": {
"height": "600"
}
}
]
}
}
]
}
}
}