Elasticsearch client for Update By Query API

Hello. I'm trying to use Update By Query API for elasticsearch version 6.3. I can't use Java High Level REST Client because Update By Query API is supported by Java High Level REST Client starting from elasticsearch version 6.5.
This is the link to the Update By Query API:


I want to use this code:
UpdateByQueryRequestBuilder updateByQuery = UpdateByQueryAction.INSTANCE.newRequestBuilder(client);
updateByQuery.source("source_index")
    .filter(QueryBuilders.termQuery("level", "awesome"))
    .size(1000)
    .script(new Script(ScriptType.INLINE, "ctx._source.awesome = 'absolutely'", "painless", Collections.emptyMap()));
BulkByScrollResponse response = updateByQuery.get();

In my code I have got a high level REST client too but I can't use it because it doesn't support update by query.
Above code requires a client. I don't know how to create it. client should be implementation of interface org.elasticsearch.client.ElasticsearchClient. My question is how to create a client?
I can't use TransportClient because it is based on TCP and I'm using elasticsearch from AWS elasticsearch service. AWS elasticsearch service supports only HTTP. AWS elasticsearch service endpoint is https://xxxxxxxxxxx.eu-west-1.es.amazonaws.com
I'm trying to use elasticsearch related client otherwise 3rd party libs. I already have high level REST client. I don't know if I can get an expected client from it.

I need a client to provide for newRequestBuilder method.
Thanks.

Welcome!

First, upgrade to the latest 6.8 version at least. Or better 7.9.3.

Then have a look at Cloud by Elastic, also available if needed from AWS Marketplace ?

Cloud by elastic is one way to have access to all features, all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL, Canvas, Maps UI, Alerting and built-in solutions named Observability, Security, Enterprise Search and what is coming next :slight_smile: ...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.