# Request/Response handlers in visualizations

**URL:** <https://discuss.elastic.co/t/request-response-handlers-in-visualizations/221727>\
**Category:** Kibana\
**Created:** [March 2, 2020, 4:22pm UTC](https://discuss.elastic.co/t/request-response-handlers-in-visualizations/221727 "2020-03-02T16:22:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arch/32/63633_2.png) [@arch](https://discuss.elastic.co/u/arch)\
**Post date:** [March 2, 2020, 4:22pm UTC](https://discuss.elastic.co/t/request-response-handlers-in-visualizations/221727/1 "2020-03-02T16:22:16Z")

</div>

Hello,

Right now I am developing a Kibana plugin for my university scientific project. It is my first experience with React, so I may miss something.  
The data is requested from ES as follows:

```
schemas: new Schemas([
    {
        group: 'metrics',
        name: 'metric',
        title: 'Metric',
        min: 1,
        defaults: [
        { type: 'max', schema: 'metric' }
        ]
    },{
        group: 'buckets',
        name: 'segment',
        title: 'Bucket Split'
    }
 ]),

```

But metrics are apparently not designed to handle string-based data and I would like to use it in my visualizations.  
To be more specific: my data describes events occurred in different countries. I would like to know in which countries a particular event type happened. _"Event type A" - "FR, GB, IT"_

I have seen an article in the documentation about request and response handlers:  
[https://www.elastic.co/guide/en/kibana/7.6/development-visualization-request-handlers.html](https://www.elastic.co/guide/en/kibana/7.6/development-visualization-request-handlers.html)

But I did not manage this function to actually request any data from ES. Could you please provide any examples of this function usage or describe more clearly, what hides behind the following code from the documentation:

```
const data = ... parse ...
return data;

```

Where do I get the data to parse if this is a request? (And the data is not yet requested)

Maybe you could provide me with a better solution to the problem?

Thank you in advance.

---

<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:** [March 24, 2020, 11:12pm UTC](https://discuss.elastic.co/t/request-response-handlers-in-visualizations/221727/2 "2020-03-24T23:12:03Z")

</div>

Hi @arch,

Our visualizations plugin infrastructure has been going through a lot of churn since `7.5` -- I have posted a more detailed explanation [in this Github issue](https://github.com/elastic/kibana/issues/52511#issuecomment-597336887), but the TLDR is that we recommend waiting to upgrade custom plugins until after `7.7`.

In the meantime, you might be interested in checking out this thread from another user who is building a custom plugin in `7.6`: [Kibana 7.6: set uiState doesn't seems to work](https://discuss.elastic.co/t/kibana-7-6-set-uistate-doesnt-seems-to-work/219844/2)

Specifically they point to [some example code they put up on Github](https://github.com/pchakour/kibanaUiStateIssues) which uses a custom request/response handler. (Worth noting that they are using Angular, not React -- I would strongly recommend sticking with React but hopefully that post is still informative).

Hope this helps a bit! We are expecting to have a much more useful (and documented!) API for custom visualizations coming soon in `7.x`

Luke

---

<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 21, 2020, 11:16pm UTC](https://discuss.elastic.co/t/request-response-handlers-in-visualizations/221727/3 "2020-04-21T23:16:26Z")

</div>

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