{
"took": 12,
"timed_out": false,
"_shards": {
"total": 5, <-- number of total shards that hits the query
"successful": 5, <-- successfully searched shards.
"skipped": 0,
"failed": 0 <-- if you see bigger than 0 the result can be partial
},
"hits": {
"total": {
"value": 100, <-- the query hit 100 results.
"relation": "eq"
},
"max_score": 1.5,
"hits": [ <-- there are 100 objects in the JSON because the size parameter in query is set to 100.
{ "_id": "1", "_source": { "name": "Item 1" } },
{ "_id": "2", "_source": { "name": "Item 2" } },
...
{ "_id": "100", "_source": { "name": "Item 100" } }
]
}
}
size参数限制返回结果的数量,如果匹配的docs数量不足100个,则返回少于100个结果,甚至可以返回0个结果。
如果分片存在任何问题,Elasticsearch 可以返回“部分结果”。通过检查
curl
API 调用响应,您可以确认这一点。作为总结性的回答,如果一切正常,如果您的查询分页为 100 个元素,并且正好有 100 个元素与您的查询匹配,那么您应该始终在响应正文中看到 100 个结果。