# Bucket Aggregation Example

**URL:** https://discuss.elastic.co/t/bucket-aggregation-example/170803
**Category:** Elasticsearch
**Created:** [March 4, 2019, 9:57pm UTC](https://discuss.elastic.co/t/bucket-aggregation-example/170803 "2019-03-04T21:57:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Vincent\_Stevenson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vincent_stevenson/32/48477_2.png) [@Vincent\_Stevenson](https://discuss.elastic.co/u/Vincent_Stevenson)
#### Post date: [March 4, 2019, 9:57pm UTC](https://discuss.elastic.co/t/bucket-aggregation-example/170803/1 "2019-03-04T21:57:30Z")

</div>

Let's say I wanted to determine which filters are relevant for a given query, ex: Amazon knows when I search 'graphics card' that the amount of GDDR5 ram would be a relevant filter for the left hand pane.

In Elasticsearch, I know there is Bucket Aggregations which sound like something that can do this, but I'm not sure how to code the JSON request.

Can you please give an example of how you could return the buckets for a given query?

Ex: `GET /_search { "size": 0, "query": { "query_string" : { "query" : "graphics card" } }, "aggs":{ (I'm not sure) } }`

Thanks!

---

<div class="post-metadata">

### Author: ![glenacota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glenacota/32/41367_2.png) [@glenacota](https://discuss.elastic.co/u/glenacota)
#### Post date: [March 5, 2019, 9:53am UTC](https://discuss.elastic.co/t/bucket-aggregation-example/170803/2 "2019-03-05T09:53:03Z")

</div>

Hi,  
I am not sure I understood your question. It'd be helpful to know the mapping of your documents

---

<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: [April 2, 2019, 9:53am UTC](https://discuss.elastic.co/t/bucket-aggregation-example/170803/3 "2019-04-02T09:53:06Z")

</div>

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