es:实现查询某个字段为固定值,另一个字段必须不能存在
要求:查询出 positionName为空,hasJobRequest为1的数据
也可以尝试用must ,must_not ,exist:
{ "query": { "bool": { "must_not": [ { "match": { "hasJobRequest": 0 } } ], "must": [ { "exists": { "field": "positionName" } }, { "range": { "id": { "gt": "90000", "lt": "110000" } } } ] } }, "size": 10000 } |