ESmust、filter、should一起使用,导致的should语句失效

更新时间:2023-07-09 18:15:47 阅读: 评论:0

ESmust、filter、should⼀起使⽤,导致的should语句失效当使⽤should查询时,如果包含了must或者filter查询,那么should的查询语句就不是或者【OR】的意思了,⽽是有或者没有都⾏的含义。
filter和should语句组合查询,会导致should语句失效
GET zx_album/album/_arch
{
"query": {
"bool": {毕节百里杜鹃
"filter": [
{立即的近义词
"term": {
"urId": {
"value": "115102970493227008",
"boost": 1
}
}
},
{
"term": {
"status": {
"value": "0",
"boost": 1
}
}
留学文书写作
}
],
"should": [
{
"term": {
"moveType": {
幼儿园寒假计划表
"value": 7,
"boost": 1
}
}
},
{
"term": {
"moveType": {
"value": 2,
"boost": 1
}
}
}
],
"disable_coord": fal,
"adjust_pure_negative": true,
"boost": 1月子餐食谱大全
}
}
}
中期检查查询的数据不对,因为should没有被正确执⾏。
解决⽅案⼀:加上"minimum_number_should_match": 1 这个设置should语句的满⾜条件值。
解决⽅案⼆:将should嵌在must语句中。
GET zx_album/album/_arch {"query": {
"bool" : {
"filter" : [
{
"term" : {
"urId" : {
"value" : "115102970493227008"          }
}
},
{
"term" : {
"status" : {
"value" : "0"
}
}
},
感激遇到你{
"bool" : {
"should" : [
{
"term" : {
"moveType" : {
"value" : 7
}
}
},
{
"term" : {
"moveType" : {
"value" : 2
}
}
}
]
}
}
]
椒盐猪手的做法}}
}
must语句和filter⼀样的做法

本文发布于:2023-07-09 18:15:47,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1074724.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:查询   语句   导致   组合   留学   猪手
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图