Update multiple documents in Elastic search using java

In java which querybuilder to use update all the documents in this specified range.!..This is my java code.
Code ---->
UpdateByQueryRequest requested = new UpdateByQueryRequest(arr[1]);
requested.setConflicts("proceed");
requested.setMaxDocs(10000);
for (Entry<String, String> entry : m1.entrySet())
{
QueryBuilder matchQueryBuilder = QueryBuilders.rangeQuery(entry.getKey()).lt(entry.getValue());
requested.setQuery(matchQueryBuilder);
}
for (Entry<String, String> entry : m.entrySet())
{
QueryBuilder q=QueryBuilders.boolQuery();
requested.setQuery(q);
}
BulkByScrollResponse bulkResponse =client.updateByQuery(requested, RequestOptions.DEFAULT);
long updateddocuments = bulkResponse.getUpdated();
if(bulkResponse!=null)
System.out.println("

Your details should be updated successfully,No of documents updated:"+updateddocuments+"

");
------->
First i have set the query for specified range by using rangeQuery and i need to update the data in that range.. Please give me the sollution to update the data in this specified range using RestHighLevelClient api.!

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