You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by GitBox <gi...@apache.org> on 2019/05/20 21:27:52 UTC

[GitHub] [metron] merrimanr commented on a change in pull request #1403: METRON-2109: Add option to use Metron GUID as the id in Elasticsearch

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:
users@infra.apache.org


With regards,
Apache Git Services