[英]Search result does not contain all hits for page
Doing a fairly standard search query on my ElasticSearch index: 对我的ElasticSearch索引执行相当标准的搜索查询:
GET /myIndex/myType/_search?q=nameEnglish:stir
I get a response like: 我得到的答复是:
{
"hits": {
"total": 2,
"max_score": 1.8492403,
"hits": [...1 object...]
},
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"timed_out": false,
"took": 1
}
So, it's telling me there were two matches, but it's only returning one. 所以,这告诉我有两场比赛,但只返回了一场。 If I want to get the other hit I have to run the query with &from=1
. 如果我想获得另一个匹配,我必须使用&from=1
来运行查询。 As I understand it, the default page size for ElasticSearch is 10 records, so why is it only returning 1? 据我了解,ElasticSearch的默认页面大小是10条记录,那么为什么它只返回1?
Adding a &size=
parameter doesn't affect the result. 添加&size=
参数不会影响结果。 I can also reproduce this with other queries (ie the number of "hits" returned being less than the page size), and the number of records returned will vary depending on whether I add a sort parameter to the query. 我还可以在其他查询中重现此信息(即,返回的“匹配”数小于页面大小),并且返回的记录数将根据是否向查询添加排序参数而有所不同。
I'm testing this on a Searchly -hosted ES index. 我正在以Searchly托管的ES索引上对此进行测试。
With default configuration of ES 1.2.1 (Win), you get 5 hits when I try your query. 使用ES 1.2.1(Win)的默认配置,当我尝试查询时,您会获得5次匹配。 Perhaps it is in the configuration of Searchly. 也许是在Searchly的配置中。
Try to query with the POST request. 尝试使用POST请求进行查询。 The answer should have the header similar (max 5 successful), but you should receive 10 (or more) resonses depending on the size parameter. 答案的标题应该相似(最多成功5个),但是您应该收到10个(或更多)共振,具体取决于size参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.