Skip to content
Snippets Groups Projects
Commit b07d3e05 authored by Neelesh Thakur's avatar Neelesh Thakur
Browse files

Merge branch 'fix-partial-record-update' into 'master'

use Index API to update the record

See merge request !488
parents 92e02ef7 09804fed
No related branches found
No related tags found
1 merge request!488use Index API to update the record
Pipeline #170784 canceled
......@@ -399,17 +399,10 @@ public class IndexerServiceImpl implements IndexerService {
jaxRsDpsLog.warning(String.format("data not found for record: %s", record));
}
OperationType operation = record.getOperationType();
Map<String, Object> sourceMap = getSourceMap(record);
String index = this.elasticIndexNameResolver.getIndexNameFromKind(record.getKind());
if (operation == OperationType.create) {
IndexRequest indexRequest = new IndexRequest(index).id(record.getId()).source(this.gson.toJson(sourceMap), XContentType.JSON);
bulkRequest.add(indexRequest);
} else if (operation == OperationType.update) {
UpdateRequest updateRequest = new UpdateRequest(index, "_doc", record.getId()).doc(this.gson.toJson(sourceMap), XContentType.JSON).docAsUpsert(true);
bulkRequest.add(updateRequest);
}
IndexRequest indexRequest = new IndexRequest(index).id(record.getId()).source(this.gson.toJson(sourceMap), XContentType.JSON);
bulkRequest.add(indexRequest);
}
return processBulkRequest(restClient, bulkRequest);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment