gpt4 book ai didi

elasticsearch - 如何让ES不得分应该引起

转载 作者:行者123 更新时间:2023-12-03 01:31:10 25 4
gpt4 key购买 nike

我只是使用ES筛选出一些数据,根本不需要评分功能。但是我必须包含一些or逻辑。我知道我们可以将must替换为filter,因此ES不会对其评分并可能对其进行缓存。如何分析should原因?

这两个查询有何不同?

{
"query": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"term": {
"closeStatus": 0
}
},
{
"bool": {
"must_not": {
"exists": {
"field": "closeStatus"
------------------------------------------------
{
"query": {
"bool": {
"should": [
{
"term": {
"closeStatus": 0
}
},
{
"bool": {
"must_not": {
"exists": {
"field": "closeStatus"

最佳答案

如果您不在乎分数,请使用 constant_score 查询:

{
"query": {
"constant_score": {
"filter": {
"bool": {
"should": [
{
"term": {
"closeStatus": 0
}
},
{
"bool": {
"must_not": {
"exists": {"field": "closeStatus"}
}
}
}
]
}
}
}
}
}

关于elasticsearch - 如何让ES不得分应该引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55899717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com