'ElasticSearch client: how to get a point in time?

I would like to use the elastic search high level client to execute this simple POST:

POST /my-index-000001/_pit?keep_alive=1m

Reading the documentation I am getting quite confused. For instance, using the IndexAPI seems a good fit, but I am not sure it is the correct path .

Can anyone show me an example?



Solution 1:[1]

Here the working solution for me:

     String endPoint = "/index-name/_pit";
        Request request = new Request("POST", endPoint);
        request.addParameter("keep_alive", "10m");
     client.getLowLevelClient().performRequest(request);

Please note the forward slash before the index-name, otherwise you will get a bad request.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simone Di Cola