title: Using AWS es using Springboot elasticSearchClient
body: <p>I am trying to connect to AWS es and perform queries using elasticSearchClient.
  But as it seems like AWS doesn't work with transport client and the alternate for transport client <code>RestHighLevelClient</code> is also being deprecated.</p>
  <p>So this is the implementation i found for the new elasticSearchClient using AWS</p>
  <pre><code>@Bean
  public ElasticsearchClient elasticsearchClient() {
          AWS4Signer signer = new AWS4Signer();
          String serviceName = &quot;es&quot;;
          signer.setServiceName(serviceName);
          signer.setRegionName(&quot;region&quot;);
          HttpRequestInterceptor interceptor = new AWSRequestSigningApacheInterceptor(serviceName, signer, &quot;credentialsProvider&quot;);
          RestClient restClient = RestClient.builder(HttpHost.create(&quot;endpoint&quot;)).setHttpClientConfigCallback(e -&gt; e.addInterceptorLast(interceptor)).build();
  
          ElasticsearchTransport transport = new RestClientTransport(
                  restClient, new JacksonJsonpMapper());
  
          ElasticsearchClient client = new ElasticsearchClient(transport);
          
          return client;
  }
  </code></pre>
  <p>where <code>ElasticsearchClient</code> is instance of <code>co.elastic.clients.elasticsearch</code>.
  Before this i was using the <code>org.elasticsearch.client.Client</code>.
  The <code>co.elastic.clients.elasticsearch.ElasticsearchClient</code> seems to have lesser functions then <code>org.elasticsearch.client.Client</code>.
  <strong>How can i migrate from the older client to the newer one?</strong>
  I can't seem to find any documentation for <code>co.elastic.clients.elasticsearch</code>.
  Any article/tutorial will be of great help.</p>
  <p>Things like client.prepareSearch have been removed and i can't find a properly documented alternate.
  The documentation persent at <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-client-javadoc.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-client-javadoc.html</a>
  is useless as it's an autogenerated one.</p>