Get List of indices using Java Rest API

I am using Java REST APIs 5.1.1 for elasticsearch. I need to get the list of indexes on successful connection to elasticsearch using host, port, username, password.
I am not able to get a list of available indexes.

Please help.

What have you tried? You can get a list of all indices with:

curl -XGET "http://localhost:9200/_aliases"

Hi @andrewkroh,

Sorry, it is my bad. Actually I got this command earlier. But I don't know how to call this using java rest APIs given.
I am new in Java development. How to execute this from RestClient, or what is the way to call this and get result in java.


Have you seen the examples here?

Response response = restClient.performRequest("GET", "/_aliases",
        Collections.singletonMap("pretty", "true"));

Then you need to unmarshal the response.

Thanks @andrewkroh,
It worked.
Though I have been through the example requests page, but I think I missed that EntityUtils thing.

Thanks again.

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