I have the following query:
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"
}
}
}
}
}
}
}
But, result has only 8 buckets and an after key. I assume that after key says that, we have more results. In that case why it's not retrieved in the same request ? Doesn't size specifies the number of buckets i expect from the aggregation results ?
Below is my response:
{
...
"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" : [
{
...
},
{
...
}
]
}
}
}
]
}
}
}
What I am missing here ?