How to get all records in bucket

{

"aggs":{
	"country":{
	"terms":{
		"field":"country.keyword"
	},
	"size":1000,
	"aggs":{
		
		"videocount":{
			"sum":{
				"field":"video_count"
			}
		},
		"viewcount":{
			"sum":{
				"field":"view_count"
			}
		},
		"subscribers":{
			"sum":{
				"field":"subscribers"
			}
		}
	}

	
	}
}

}

Welcome!

Have a look at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-size

how to fetch all records without specify the size

Did you read the link I shared? There's a Note.

That being said. Do you want to retrieve all hits or all terms coming from the terms aggregation?

yes i want all hits and all terms from the terms aggregation without specifying size because i don't know how many records coming from the terms aggregation then how to specify size

if i not specify the size the buckets get only default record 10 but i need all records

Ok. So did you read the Note? Or do I need to paste its content here?

yes i read

So you have the answer right?
Is there anything else we can help ?

still i did not get the solution

What did you try? Could you share a full example of what you did?

See About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

{
"aggs" : {
"titles" : {
"terms" : { "field" : "country.keyword" },
"aggs": {
"ids": {
"terms": { "field" : "channel_id.keyword" }
}
}
}
}
}

Each buckets taken default 10 records only can you please help me what is wrong in this query and i dont know where can i use composite key

There's an example in the composite aggregation page which says how to paginate.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html#_pagination

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.