# How to access aggregations from within custom request handler

**URL:** <https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445>\
**Category:** Kibana\
**Created:** [April 3, 2020, 5:24pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445 "2020-04-03T17:24:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [April 3, 2020, 5:24pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445/1 "2020-04-03T17:24:41Z")

</div>

Is it possible to access the aggregations from within a custom visualization request handler? I'm currently not seeing the aggs object contained within the object that is passed into the custom request handler. I'm trying to build a custom Elasticsearch query from within the request handler but I need access to the aggregations to do this. I'm currently using Kibana 7.5.2.

---

<div class="post-metadata">

**Author:** ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)\
**Post date:** [April 7, 2020, 1:30pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445/2 "2020-04-07T13:30:32Z")

</div>

Anyone have an answer for this? I thought it was a pretty straight forward question. How do you get access to the aggregations from within a custom request handler? Thanks!

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [April 13, 2020, 10:23pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445/3 "2020-04-13T22:23:59Z")

</div>

@jbudz can you shed some light here ?

---

<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 11, 2020, 10:24pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445/4 "2020-05-11T22:24:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [June 1, 2020, 11:32pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445/5 "2020-06-01T23:32:27Z")

</div>

Just wanted to leave a note that it looks like this was removed for custom request handlers as part of migration efforts in our visualization infrastructure, but I don't believe we did this intentionally (in short: it's a bug). There has been a lot of churn in our visualizations which I explain in more detail in [Request/Response handlers in visualizations](https://discuss.elastic.co/t/request-response-handlers-in-visualizations/221727/2) and the corresponding Github issue.

At the moment I believe this would affect any plugins in 7.5-7.7 registering visualizations which are also using a custom requestHandler that needs access to aggs.

I'm working to get this re-added soon... Here's the Github issue if you'd like to follow along: [https://github.com/elastic/kibana/issues/67916](https://github.com/elastic/kibana/issues/67916)

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [July 16, 2020, 8:23pm UTC](https://discuss.elastic.co/t/how-to-access-aggregations-from-within-custom-request-handler/226445/6 "2020-07-16T20:23:32Z")

</div>

Following up to confirm that this issue has been resolved -- we're currently expecting it to be available starting in `7.8.2`
