merrimanr 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_r286134724
##########
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:
You're right, those log statements are not quite correct anymore. I updated
them in the latest commit.
----------------------------------------------------------------
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