# API'S

**URL:** <https://discuss.elastic.co/t/apis/167893>\
**Category:** Elasticsearch\
**Created:** [February 11, 2019, 4:06pm UTC](https://discuss.elastic.co/t/apis/167893 "2019-02-11T16:06:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [February 11, 2019, 4:06pm UTC](https://discuss.elastic.co/t/apis/167893/1 "2019-02-11T16:06:13Z")

</div>

Hello All,  
Can we use Java to only read data from elasticsearch that we are already ingested logs file to elasticsearch?  
not to index from java and retrieving, only to read already created logs file's instead of kibana to get as JSON from java?

or else any other way?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 11, 2019, 4:18pm UTC](https://discuss.elastic.co/t/apis/167893/2 "2019-02-11T16:18:16Z")

</div>

Yes.

Although I'm not quite I understood what you meant by "read data from elasticsearch"...

Do you mean search? To you mean extract all data that matches a search?  
Anyway, this is all possible with the Java Rest Client.

---

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [February 11, 2019, 4:34pm UTC](https://discuss.elastic.co/t/apis/167893/3 "2019-02-11T16:34:56Z")

</div>

what exactly is  
i have ingested logs to elasticsearch through logstash and that logs can be viewed using java?(springboot) or anything else? without kibana

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 11, 2019, 4:35pm UTC](https://discuss.elastic.co/t/apis/167893/4 "2019-02-11T16:35:20Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [February 11, 2019, 4:37pm UTC](https://discuss.elastic.co/t/apis/167893/5 "2019-02-11T16:37:25Z")

</div>

can you explain in details? by which  
in tutorial i have shown only springboot with elasticsearch to index our document and retriveing?

how can we view logs? that are already stored?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 11, 2019, 4:52pm UTC](https://discuss.elastic.co/t/apis/167893/6 "2019-02-11T16:52:45Z")

</div>

```auto
public class App {
    public static void main(String[] args) throws IOException {
        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(HttpHost.create("http://localhost:9200")));

        SearchResponse response = client.search(new SearchRequest(), RequestOptions.DEFAULT);

        System.out.println("response = " + response);

        client.close();
    }
}

```

---

<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:** [March 11, 2019, 4:52pm UTC](https://discuss.elastic.co/t/apis/167893/7 "2019-03-11T16:52:47Z")

</div>

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