gpt4 book ai didi

node.js - Elasticsearch:空命中数组,尽管总数大于 0

转载 作者:太空宇宙 更新时间:2023-11-04 02:18:13 25 4
gpt4 key购买 nike

对于以下查询

    {
index: i,
from: 0,
size: 10,
body: {
query: {
filtered: {
query: {
term: { "si" : si}
}
}
}
}
}

我收到以下答案

    {
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 5.1108737,
"hits": [

]
}
}

我发现这篇文章关于同一主题https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930但还是不明白,如何解决我的问题,因为我想

from: 1

按照他的解决方案可以解决问题。

感谢您的帮助

最佳答案

By default, elasticsearch starts showing its  Query results from pageNum as 0 and the search query we define generally start from pageNum as 1.
Ensure that if you are setting the pageNum, it is set to 0 in case you have the resultset within the pageSize limit.

我遇到了同样的问题,我可以看到total_hits为1,并且返回空数组。我发现我将默认 pageNum 设置为 1 ,但是 elasticsearch 从 0 开始,因此当使用 pageNum 作为 1 查询时返回第二页

关于node.js - Elasticsearch:空命中数组,尽管总数大于 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34791092/

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