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.