0
我试图在弹性中构建查询,但未按预期工作。发布构建使用or而不是联系的弹性查询
SQL查询将
select * from xyz
where (phone1 = "1234" or phone2 ="1234" or phone3 = "1234")
and status != "Z"
我想这有PHONE1或PHONE2或电话3场和状态的1234值的记录并不等于到z
我有弹性建立下面的查询,但它即使状态值等于z,也会返回记录。不知道我错过了什么。
{
"query": {
"bool": {
"should": [
{
"term": {
"phone1": "1234"
}
},
{
"term": {
"phone2": "1234"
}
},
{
"term": {
"phone3": "1234"
}
}
],
"minimum_should_match": 1,
"must_not": {
"term": {
"status": "Z"
}
}
}
}
}