Java 如何使用JestClient手动调用ElasticSearch的快照端点

Java 如何使用JestClient手动调用ElasticSearch的快照端点,java,aws-elasticsearch,elasticsearch-snapshot,elasticsearch-jest,Java,Aws Elasticsearch,Elasticsearch Snapshot,Elasticsearch Jest,我已经在AWS上的ES上使用JestClinet执行所有CRUD操作。现在,我正尝试按中所述对我的ES进行快照 除了使用另一个RestClient,我想知道是否可以使用我现有的JestClient我找不到使用JestClient的方法,使用RestClient如下: String snapshotPath = "/_snapshot/my_repot/snapshot1?wait_for_completion=true"; HttpEntity entity = new NStringEnti

我已经在AWS上的ES上使用
JestClinet
执行所有CRUD操作。现在,我正尝试按中所述对我的ES进行快照


除了使用另一个
RestClient
,我想知道是否可以使用我现有的
JestClient

我找不到使用JestClient的方法,使用RestClient如下:

String snapshotPath = "/_snapshot/my_repot/snapshot1?wait_for_completion=true";
HttpEntity entity = new NStringEntity("{}", ContentType.APPLICATION_JSON);
Header header = new BasicHeader("Content-Type", "application/json");

try{
  final AWSSigner awsSigner = new AWSSigner(awsAuthProvider, region, "es",
    () -> LocalDateTime.now(ZoneOffset.UTC));
  final AWSSigningRequestInterceptor requestInterceptor = new AWSSigningRequestInterceptor(awsSigner);

  RestClient restClient = RestClient.builder(HttpHost.create(elasticUrl))
        .setRequestConfigCallback(rcc -> rcc.setSocketTimeout(15 * 60 * 1000))
        .setHttpClientConfigCallback(hacb -> hacb.addInterceptorLast(requestInterceptor))
        .setMaxRetryTimeoutMillis(15 * 60 * 1000)
        .build();
  response = restClient.performRequest("PUT", snapshotPath, Collections.emptyMap(), entity, header);

  if(200 == response.getStatusLine().getStatusCode()) {     
    return true;
  }else {       
    return false;
  }
}catch(IOException e) {
  return false;
}

我找不到使用JestClient的方法,使用RestClient如下:

String snapshotPath = "/_snapshot/my_repot/snapshot1?wait_for_completion=true";
HttpEntity entity = new NStringEntity("{}", ContentType.APPLICATION_JSON);
Header header = new BasicHeader("Content-Type", "application/json");

try{
  final AWSSigner awsSigner = new AWSSigner(awsAuthProvider, region, "es",
    () -> LocalDateTime.now(ZoneOffset.UTC));
  final AWSSigningRequestInterceptor requestInterceptor = new AWSSigningRequestInterceptor(awsSigner);

  RestClient restClient = RestClient.builder(HttpHost.create(elasticUrl))
        .setRequestConfigCallback(rcc -> rcc.setSocketTimeout(15 * 60 * 1000))
        .setHttpClientConfigCallback(hacb -> hacb.addInterceptorLast(requestInterceptor))
        .setMaxRetryTimeoutMillis(15 * 60 * 1000)
        .build();
  response = restClient.performRequest("PUT", snapshotPath, Collections.emptyMap(), entity, header);

  if(200 == response.getStatusLine().getStatusCode()) {     
    return true;
  }else {       
    return false;
  }
}catch(IOException e) {
  return false;
}