API'S


(Dv Thiyanesh) #1

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?


(David Pilato) #2

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.


(Dv Thiyanesh) #3

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


(David Pilato) #4

Yes.


(Dv Thiyanesh) #5

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?


(David Pilato) #6
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();
    }
}

(system) closed #7

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