14

How can we request Kibana with REST API to get the visualization request and response?

Like this: screenshot

I want to do that using NodeJS to manipulate this results of Kibana. The purpose is that I want to directly query Kibana programmatically (via REST API) to get the ES request body.

Adam Michalik
  • 9,678
  • 13
  • 71
  • 102
Nader
  • 143
  • 1
  • 2
  • 7
  • ** I want to directly query Kibana programmatically (via REST API) to get the ES request body. – Nader Aug 05 '15 at 08:28
  • Don't think this is possible. There is a .kibana index, this does contain the configuration of the dashboard. But I do not see the actual query that is performed in there. – Jettro Coenradie Aug 05 '15 at 12:01

2 Answers2

12

You can directly request the ES. The documentation is here

mherbert
  • 515
  • 3
  • 12
  • 2
    thank you for your response, but i would like to know if there is a way to query kibana – Nader Aug 05 '15 at 11:02
  • 3
    You can do that but it's not the purpose of Kibana. This tool is just a visualization tool. So If you want to try it, you can see the request that kibana does (F12 on your browser). – mherbert Aug 05 '15 at 12:21
  • I can see the request in kibana , under the graph but can we call it programmatically ? – Nader Aug 05 '15 at 12:30
  • As I said before, I think the best way to get response from ES is to call the ES API. You can do that with the JAVA API : [link](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/search.html) – mherbert Aug 05 '15 at 12:41
  • 1
    kibana gives heap size, request per second.. like that parameters. I want to implement dash board using these data.Is the rest api that gives these data from kibana – Buddhika Kulathilaka Mar 04 '16 at 10:15
  • 1
    hey @Nader, if you got the solution to query Kibana from JAVA then pls share it.As I also need the same – NIket Mar 08 '16 at 05:56
  • 1
    If I query ES for a field equal to a given value and I get the response then how can change the kibana graph from that response on my webpage ? – Nishank Singla Apr 30 '16 at 20:16
  • I just want to use kibana for a front end i dont want to hit api of elasticsearc rather i want to hit on other api can we do it ? – Aatif Bandey Jun 15 '16 at 17:24
  • My issue is Kibana front-end is exposed for me to access but the backing ES endpoint is not. I want to avoid using UI Automation to pull logs for validation test steps. Most of my tests are using SoapUI so a REST plugin would be best... but a simplified HTTP(s) request would also work. (FYI the Kibana/dev_tools/console is currently disabled :-( .) – Zephan Schroeder Feb 08 '18 at 03:51
1

You can go to kibana\kibana-4.5.1-windows\optimize\bundles\kibana.bundle.js file, search the function "Transport.prototype.request = function (params, cb)", and add in the first line parent.postMessage(params.body, "*"); Now go to the controller or script that manage the iframe(iframe parent) and add

$window.addEventListener("message", function (event) {          
              var data=event.data;          
            });

for example:

    <iframe id="ifr" src="http://localhost:5601/goto/6ba8a6b8ceef3tyt454789e4fe5cf5"></iframe>

    <script>
        $window.addEventListener("message", function (event) {          
          var data=event.data;          
        });
    </script

Now you will get the request query

Lax
  • 1,109
  • 1
  • 8
  • 13