# How to get all records in bucket

**URL:** <https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216>\
**Category:** Elasticsearch\
**Created:** [April 22, 2020, 9:15am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216 "2020-04-22T09:15:16Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 22, 2020, 9:15am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/1 "2020-04-22T09:15:17Z")

</div>

{

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

	
	}
}

```

}

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 22, 2020, 9:26am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/2 "2020-04-22T09:26:57Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-size)

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 22, 2020, 9:35am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/3 "2020-04-22T09:35:41Z")

</div>

how to fetch all records without specify the size

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 22, 2020, 11:27am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/4 "2020-04-22T11:27:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 24, 2020, 2:36am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/5 "2020-04-24T02:36:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 24, 2020, 2:37am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/6 "2020-04-24T02:37:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 24, 2020, 2:50am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/7 "2020-04-24T02:50:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 24, 2020, 3:40am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/8 "2020-04-24T03:40:49Z")

</div>

yes i read

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 24, 2020, 7:12am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/9 "2020-04-24T07:12:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 27, 2020, 3:58am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/10 "2020-04-27T03:58:40Z")

</div>

still i did not get the solution

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 27, 2020, 4:11am UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/11 "2020-04-27T04:11:41Z")

</div>

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

See [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). 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.

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 27, 2020, 12:02pm UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/12 "2020-04-27T12:02:32Z")

</div>

{  
"aggs" : {  
"titles" : {  
"terms" : { "field" : "country.keyword" },  
"aggs": {  
"ids": {  
"terms": { "field" : "channel\_id.keyword" }  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)\
**Post date:** [April 27, 2020, 12:04pm UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/13 "2020-04-27T12:04:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 27, 2020, 12:28pm UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/14 "2020-04-27T12:28:44Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html#_pagination)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 25, 2020, 12:28pm UTC](https://discuss.elastic.co/t/how-to-get-all-records-in-bucket/229216/15 "2020-05-25T12:28:51Z")

</div>

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