Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

I'm already using JestClinet for all my CRUD operations on my ES on AWS. Now I'm trying to snapshot my ES as described in

Instead of using another RestClient, I'm wondering if I can use my existing JestClient.

1 Answer

0 votes
by (44.3k points)

No, I don’t have it with jestclient, but check this out with 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");


  final AWSSigner awsSigner = new AWSSigner(awsAuthProvider, region, "es",

    () ->;

  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)


  response = restClient.performRequest("PUT", snapshotPath, Collections.emptyMap(), entity, header);

  if(200 == response.getStatusLine().getStatusCode()) {     

    return true;

  }else {       

    return false;


}catch(IOException e) {

  return false;


Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories