es 中有两条数据, 字段 item
- 编制服务
- 工厂制服
想通过“match_phrase”搜索“制服”得到第 2 条数据,排除第 1 条数据,以下语句却能得到 2 条数据,请问怎么写才能达到目的?
{
"query": {
"bool": {
"filter": {
"bool": {
"should": [
{
"match_phrase": {
"item": {
"query": "制服"
}
}
}
]
}
},
"must_not": [
{
"match_phrase": {
"item": {
"query": "制服务"
}
}
}
]
}
}
