# Are contents of a bucket held in the same shard?

**URL:** <https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059>\
**Category:** Elasticsearch\
**Created:** [July 23, 2018, 1:04am UTC](https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059 "2018-07-23T01:04:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Ramierez](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@Jose\_Ramierez](https://discuss.elastic.co/u/Jose_Ramierez)\
**Post date:** [July 23, 2018, 1:04am UTC](https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059/1 "2018-07-23T01:04:15Z")

</div>

We are evaluating using buckets to keep data by user account in a single bucket (e.g. the bucket becomes the "accountid" container, holding all documents for that account)

The question has arisen: If we have a 20 or 100 shard index, will a given bucket always be kept within a single shard?

If not, how many shards will it span?

---

<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:** [July 23, 2018, 1:22am UTC](https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059/2 "2018-07-23T01:22:45Z")

</div>

Yes. All data for a given account will go to one single shard.

---

<div class="post-metadata">

**Author:** ![Jose\_Ramierez](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@Jose\_Ramierez](https://discuss.elastic.co/u/Jose_Ramierez)\
**Post date:** [July 23, 2018, 5:56am UTC](https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059/3 "2018-07-23T05:56:52Z")

</div>

David,

Does that mean that a bucket + shards + routing will:

- give me control over which shard an account lives on
- give me more ES performance on queries, since, in all architectres, I will always have multiple accounts per shard

?

---

<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:** [July 23, 2018, 7:05am UTC](https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059/4 "2018-07-23T07:05:49Z")

</div>

Yes.

---

<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:** [September 9, 2018, 11:39pm UTC](https://discuss.elastic.co/t/are-contents-of-a-bucket-held-in-the-same-shard/141059/6 "2018-09-09T23:39:11Z")

</div>

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