# Java script code to get content from KIBANA

**URL:** <https://discuss.elastic.co/t/java-script-code-to-get-content-from-kibana/129725>\
**Category:** Kibana\
**Created:** [April 26, 2018, 5:10pm UTC](https://discuss.elastic.co/t/java-script-code-to-get-content-from-kibana/129725 "2018-04-26T17:10:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mas](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mas](https://discuss.elastic.co/u/Mas)\
**Post date:** [April 26, 2018, 5:10pm UTC](https://discuss.elastic.co/t/java-script-code-to-get-content-from-kibana/129725/1 "2018-04-26T17:10:50Z")

</div>

## 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](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](mailto:sabzshop@gmail.com)  
[mass\_sabz@yahoo.com](mailto:mass_sabz@yahoo.com)

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [April 27, 2018, 12:51am UTC](https://discuss.elastic.co/t/java-script-code-to-get-content-from-kibana/129725/2 "2018-04-27T00:51:34Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html) can get you started.

---

<div class="post-metadata">

**Author:** ![Mas](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mas](https://discuss.elastic.co/u/Mas)\
**Post date:** [April 27, 2018, 3:38am UTC](https://discuss.elastic.co/t/java-script-code-to-get-content-from-kibana/129725/3 "2018-04-27T03:38:30Z")

</div>

thank you dear jon Budzenski

---

<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:** [May 25, 2018, 3:38am UTC](https://discuss.elastic.co/t/java-script-code-to-get-content-from-kibana/129725/4 "2018-05-25T03:38:30Z")

</div>

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