# Getting multiple values in a bucket

**URL:** <https://discuss.elastic.co/t/getting-multiple-values-in-a-bucket/35484>\
**Category:** Elasticsearch\
**Created:** [November 24, 2015, 8:36pm UTC](https://discuss.elastic.co/t/getting-multiple-values-in-a-bucket/35484 "2015-11-24T20:36:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_Diego\_Calle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_diego_calle/32/6037_2.png) [@Juan\_Diego\_Calle](https://discuss.elastic.co/u/Juan_Diego_Calle)\
**Post date:** [November 24, 2015, 8:36pm UTC](https://discuss.elastic.co/t/getting-multiple-values-in-a-bucket/35484/1 "2015-11-24T20:36:06Z")

</div>

I have a type called vehicle and it has this fields attributes.brand.value and attributes.brand.id I will like to create a bucket for attributes.brand. ID and VALUE will always match because they come from our database.  
The only way I can think of this is creating nested buckets, like this

```
"aggs": {
    "years": {
      "terms": {
        "field": "attributes.brand.value.raw",
        "size": 0,
        "order": {
          "_term": "DESC"
        }
      },
      "aggs": {
        "id": {
          "terms": {
            "field": "attributes.brand.id",
            "size": 0
          }
        }
      }
    }
  }

```

In my tests this seemed expensive in CPU and RAM.

---

<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:** [July 5, 2017, 11:36pm UTC](https://discuss.elastic.co/t/getting-multiple-values-in-a-bucket/35484/2 "2017-07-05T23:36:11Z")

</div>

Closed on July 5, 2017, 11:36pm UTC


