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_r285775129
 
 

 ##########
 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:
   Are you sure these are incorrect?  The shards are coming directly from the 
response so I would expect it to be accurate.

----------------------------------------------------------------
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

Reply via email to