我想在一个布尔查询中将must和must_not与AND结合在一起。我想获取那些名称为john且不可以不等于1的记录
在下面尝试过但没用
{
"query": {
"bool": {
"must": [{
"query_string": {
"query": "*alen*",
"fields": [
"name"
]
}
}],
"must_not": [{
"match": {
"no": "1"
}
}]
}
}
}
得到
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}