gpt4 book ai didi

elasticsearch - 使用术语/范围查询时发现0值的问题

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

我的索引上有一个数字字段,可作为一个计数,问题是当我尝试查询该字段等于0时,我没有任何值。

我确定索引中可能的值,因为如果我不使用任何过滤器就执行查询,则该字段至少返回50次,其中字段等于0。

我尝试用词:

GET contacts/_search
{
"query": {
"term": {
"investmentsCount": {
"value": 0
}
}
}
}

或使用范围
GET contacts/_search
{
"query": {
"range": {
"investmentsCount": {
"lte": 0
}
}
}
}

另外,我尝试使用range与“lt”:1,它没有返回任何内容。即使我尝试less_than <2,我也只会收到count = 1的那些,而不是0的那些。有小费吗?

样本文件:

GET contacts/_search
{
"query": {
"term": {
"investmentsCount": {
"value": 1
}
}
}
}

"hits" : {
"total" : {
"value" : 432,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "contacts",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"id" : "1",
"accountId" : "1",
"committed" : 7500000,
"contributed" : 7500000,
"investedMax" : "2020-03-18T01:53:31.160Z",
"investedMin" : "2020-03-18T01:53:31.160Z",
"investmentsCount" : 1,
"status" : "ACTIVE",
"updated" : "2020-03-18T01:43:39.854Z",
"userId" : "1",
"withdrawnMax" : "2020-03-18T01:53:58.092Z",
"withdrawnMin" : "2020-03-18T01:53:58.092Z"
}
}
]
}

最佳答案

尝试运行汇总查询以查看investmentsCount的唯一值。我最有可能在猜测该字段未填充值0,在这种情况下,您将需要更正提取过程。

关于elasticsearch - 使用术语/范围查询时发现0值的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61410833/

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