Request/Response handlers in visualizations

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

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.

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, 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

Specifically they point to some example code they put up on Github 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

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