如何使用JAVA高级REST客户端发出Elasticsearch的Point InTime API请求

问题描述:

如果有人可以向我指出一种使用REST高级客户端从JAVA中执行在Elasticsearch 7.10.1中新引入的Point In Time API请求的方法,则它会有所帮助.(Transport客户端除外,因为它将很快弃用)

It will be helpful if someone can point me to a way to execute Point In Time API request, which is newly introduced in Elasticsearch 7.10.1, from JAVA using REST high-level client or any other way in JAVA. (except Transport client as it is going to be deprecated soon)

当高级rest客户端没有任何api的包装器时,低级别rest客户端将开始救援.您可以通过高级客户端使用低级客户端,如下所示:

Low level rest client comes to rescue when high level rest client doesn't have a wrapper for any api. You can use low level client via high level client as below:

String endPoint = "my-index-000001/_pit";
Request request = new Request("POST", endPoint);
request.addParameter("keep_alive", "1m");
Response response = highLevelClient.getLowLevelClient().performRequest(request);

然后使用 response 对象提取相关信息.

Then use the response object to extract out the relevant information.