【发布时间】:2021-05-24 12:45:40
【问题描述】:
//实体模型定义
@Builder.Default
@LastModifiedDate
@Field(type = FieldType.Date, name = "modified_dt", format = DateFormat.basic_date_time)
private Instant modifiedDate = Instant.now();
//更新属性调用
protected void updateAttribute(String id, Document document) throws Exception {
UpdateQuery updateQuery = UpdateQuery.builder(id).withDocument(document).build();
UpdateResponse updateResponse = operations.update(updateQuery, indexCoordinates());
Result result = updateResponse.getResult();
if (!result.equals(Result.UPDATED)) {
throw new Exception();
}
}
【问题讨论】:
-
我需要更新 LastModifiedDate,你的回答没有解决这个问题
标签: elasticsearch spring-data-elasticsearch