[英]Elasticsearch: empty hits array although total is greater than 0
對於以下查詢
{
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時返回第二頁。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.