这可能是一个初学者的问题,但我对大小有一些疑问。 根据弹性搜索规范,大小的最大值可以是10000,我想验证下面的理解:
示例查询:
GET testindex-2016.04.14/_search
{
"size": 10000,
"query": {
"bool": {
"must": [
{
"match": {
"type": "TEST"
}
}
]
}
},
"aggs": {
"testAggs": {
"terms": {
"field": "type",
"size": 0
},
"aggs": {
"innerAggs": {
"max": {
"field": "Value"
}
}
}
}
}
}
响应:
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 26949,
"max_score": 0,
"hits": [
.....10000 records
]
},
"aggregations": {
"test": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "TEST",
"doc_count": 26949,
"innerAggs": {
"value": 150
}
}
]
}
}
}
1 - 如果size设置为10000,并且我们在弹性搜索中有超过200000条记录满足查询,那么在查询结果中,我将得到no。命中率为10000,但总数为" :200000。
2 - 可用于进一步聚合的记录数量 - 数量。点击次数或"总计"值。
3 - 如果我们设置" size" :0,在这种情况下,我们得到hits = 0,但有多少记录可用于聚合?
请澄清我的理解,并对任何疑问提出意见。感谢。
答案 0 :(得分:3)
size
参数仅告知响应中应返回多少匹配,因此如果指定大小:10000和200000条记录匹配,则结果匹配中将获得10000个匹配文档,但total
将声明200000
总是在整个结果集上计算聚合,因此total
值。
见2