我有以下查询:
GET index_name/_search
{
"size": 0,
"aggs": {
"my_buckets": {
"composite": {
"size": 100,
"sources": [
{
"field1": {
"terms": {
"field": "field1"
}
}
},
{
"field2": {
"terms": {
"field": "field2.raw"
}
}
},
{
"field3": {
"terms": {
"field": "field3"
}
}
},
{
"field4": {
"terms": {
"field": "field4.raw"
}
}
},
...
{
"field7": {
"terms": {
"field": "field7"
}
}
}
]
},
"aggregations": {
"hits": {
"top_hits": {
"size": 100,
"_source": {
"includes": "field10"
}
}
}
}
}
}
}
但是,结果只有 8 个桶和一个后键。我假设在 key 这么说之后,我们有更多的结果。在那种情况下,为什么不在同一个请求中检索它?大小不是指定我期望从聚合结果中获得的桶数吗?
以下是我的回复:
{
...
"hits" : {
...
},
"aggregations" : {
"my_buckets" : {
"after_key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"buckets" : [
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
...
]
}
}
},
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
...
]
}
}
},
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
...
]
}
}
},
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
...
]
}
}
},
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
...
]
}
}
},
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
...
]
}
}
},
{
"key" : {
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 1,
"hits" : {
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
...
}
]
}
}
},
{
"field1" : 0.0,
"field2" : "0.0",
"field3" : some-value,
"field4" : "0.0",
"field5" : "some-value",
"field6" : "0.0",
"field7" : 0
},
"doc_count" : 2,
"hits" : {
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [
{
...
},
{
...
}
]
}
}
}
]
}
}
}
我在这里想念什么?