nickwallen commented on a change in pull request #1403: METRON-2109: Add option
to use Metron GUID as the id in Elasticsearch
URL: https://github.com/apache/metron/pull/1403#discussion_r286124417
##########
File path:
metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/writer/ElasticsearchWriter.java
##########
@@ -139,8 +140,12 @@ private MessageIdBasedDocument
createDocument(BulkMessage<JSONObject> bulkWriter
} else {
LOG.warn("Missing '{}' field; timestamp will be set to system time.",
TIMESTAMP.getName());
}
-
- return new MessageIdBasedDocument(source, guid, sensorType, timestamp,
bulkWriterMessage.getId());
+ MessageIdBasedDocument messageIdBasedDocument = new
MessageIdBasedDocument(source, guid, sensorType, timestamp,
bulkWriterMessage.getId());
+ if (metronId) {
+ // Use the metron-generated GUID instead of letting Elasticsearch set
the id
+ messageIdBasedDocument.setDocumentID(guid);
Review comment:
[These are the log
statements](https://github.com/apache/metron/blob/2d2cec749c52659f4cf5b9177047b018222a13cd/metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/bulk/ElasticsearchBulkDocumentWriter.java#L129-L138)
that I was thinking of.
Previously, if the document ID was not set, the document was new. Now with
these changes that may not be the case. We probably just alter/edit/remove
these comments.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services