## 搜索包含java,不包含spark(如果包含spark不会说不需要,而是降低评分)
GET customer/_search
{
"query": {
"boosting": {
"positive": {
"match": {
"introduce": "Java"
}
},
"negative": {
"match": {
"introduce": "spark"
}
},
"negative_boost": 0.2
}
}
}
## 没有评分
GET customer/_search
{
"query": {
"bool": {
"should": [
{
"constant_score": {
"filter": {
"match": {
"introduce": "java"
}
}
}
},
{
"constant_score": {
"filter": {
"match": {
"introduce": "spark"
}
}
}
}
]
}
}
}
ES7.16.2基础操作-评分优化(九)
最新推荐文章于 2024-01-17 08:15:00 发布
本文探讨了如何使用高级搜索策略,在客户数据中找到专注于Java技术,但排除涉及Spark的相关介绍。通过Boosting查询,确保结果仅包含介绍中包含'Java'而不包含'Spark'的客户信息。
770

被折叠的 条评论
为什么被折叠?



