Java script code to get content from KIBANA

I need to use an HTTP Request and Find a way in JAVA SCRIPTt to get CONTENT from Kibana
I need and want almost this similar thing:

var my_content_from_file = file_content(ext + file_name)
out(my_content_from_file)

//I have to find a way to get CONTENT from Kibana

/*
curl -XGET "https://87b256626e4ad11cd37ac6d84dcba640.us-east-1.aws.found.io:9243/strokes_000000785_sherry_003/_search" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} } }'
*/

//I need to find and write an HTTP Request

var my_content_from_elasticsearch_response = "?"
out(my_content_from_elasticsearch_response)

I know there is a simple code in "JAVA!!" not java script like here:

GetRequest get = new GetRequest(queryString);

//HARD PART - NEED TO INCLUDE USERNAME AND PASSWORD
get.addUser("sabzshop@gmail.com", "mypassword");
get.send();

println("Reponse Content: " + get.getContent());

String content = get.getContent();
JSONObject response = parseJSONObject(content);
return response;

what should I do?
Do you have any similar experience in this area?
thank youvery much and appreciate for your attention.
Sincerely yours,
Mas Hei
sabzshop@gmail.com
mass_sabz@yahoo.com

What content are you trying to get from Kibana? Kibana has APIs for certain areas but most requests proxied to elasticsearch. If you want elasticsearch data I'd recommend using the elasticsearch-js client. If you want Kibana data you'll need to pull in a library or use browser/server apis.

If it's the former https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html can get you started.

1 Like

thank you dear jon Budzenski

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