1

With Some Criteria or Query I would like to filter all ElasticSearch Documents and then Partial Update them

I am looking for ElasticSearchTemplate Alternative for mongoTemplate.updateMulti(Query,Update,Class)

Right now I am getting distinct IDs and Updating manually one by one via

private UpdateQuery updateExistingDocument(String Id) {
    // Add updatedDateTime, CreatedDateTime, CreateBy, UpdatedBy field in existing documents in Elastic Search Engine
    UpdateRequest updateRequest = new UpdateRequest().doc("UpdatedDateTime", new Date(), "CreatedDateTime", new Date(), "CreatedBy", "admin", "UpdatedBy", "admin");

    // Create updateQuery
    UpdateQuery updateQuery = new UpdateQueryBuilder().withId(Id).withClass(ElasticSearchDocument.class).build();
    updateQuery.setUpdateRequest(updateRequest);

    // Execute update
     elasticsearchTemplate.update(updateQuery);
}

How to do it in Bulk?

Ashish
  • 1,856
  • 18
  • 30
  • @Alon : Can you find Query or Criteria Filter in SO link you shared ?. Thats Updating single document one by one. I want to filter by a criteria then apply update. How it could be possible duplicate ? – Ashish Jun 06 '19 at 11:32
  • I am looking `ElasticSearch` alternative for `mongoTemplate.updateMulti(query,update,class);` – Ashish Jun 06 '19 at 11:35

0 Answers0