Question about the possibilities of Kibana and code development

Hello!
We have crm for our customers.
In the kibana there is information about the orders of our customers.
We want to display the embedded dashboard on a specific page in our crm so that each client sees the graphs only for their orders.
Plus, some clients must see the orders of other clients.

Question 1. Is it possible to immediately authorize a user in embedded, for example, pass some parameters to a iframe with a dashboard?
Question 2. Where can I write code that will modify the request in elasticsearch, adding an additional condition for filtering to it? Can I do this through the custom plugin?

Hi and welcome to our community! :wave:

About 1:
There's an older discuss article about that, so it's possible:

About 2:
Which request do you want to modify?

Thanx and best,
Matthias

Thanks for the help! :slight_smile:

All requests for data for the graphs.

If you want to add additional filtering to it you can add it via url. If you add a filter in dashboard, the url is modified. Of course you can also add a filter via url manually.
Best,
Matthias

If you add filtering via URL, then the user will be able to change it.

I had such an idea:

  1. In elasticsearch there is a customer_id field;

  2. In the iframe in the URL, I add a parameter, for example, current_customer_hash, which is generated in our crm;

  3. On the kibana's backend, before sending the request to elasticsearch, I get current_customer_hash, which I passed to the URL.

  4. I make a request to my server https://crm.myserver.com/api/get_available_customers/{{current_customer_hash}}, and get an array of allowed customer_id for current_customer_hash. For example, I will get the answer [433, 936, 209];

  5. I modify elasticsearch request, add the filter "customer_id = [433, 936, 209]" there.

Is it possible to do as I wrote above?

Hi
In theory this should be possible, but you's need to develop an own custom dashboard plugin for that purpose. And there's no way to e.g. add filters to the existing dashboard requests depending on user permission, so you'd need to create an own solution for this (the effort for this is not to underestimate)
Best,
Matthias

Hi. Thanks for the answer.

How can I get acquainted with the internal architecture of the Kibana? Is there any documentation for developers?

Hi
this is a possible starting point:
https://www.elastic.co/guide/en/kibana/current/plugin-development.html
and also a good start is taking a look at existing 3rd party plugins at GitHub

Here's a list of plugins:

Note that we're currently in between a big architectural change, so APIs change and should be final when our next major is released

Best,
Matthias

Сan I make my own plugin that will implement custom search strategy, which will be a proxy for the default search strategy?

While in theory this is possible, it's very complex, and the API will change a lot. A better approach might be to solve this via the Elastic Search document level security

https://www.elastic.co/guide/en/elasticsearch/reference/current/document-level-security.html

So you can define roles that grant only read access to documents with e.g. a certain customer_id

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