AndreLouisCaron commented on a change in pull request #322: Honor UUID 
interceptor in ElasticSearch sink
URL: https://github.com/apache/flume/pull/322#discussion_r399456518
 
 

 ##########
 File path: 
flume-ng-sinks/flume-ng-elasticsearch-sink/src/main/java/org/apache/flume/sink/elasticsearch/client/ElasticSearchRestClient.java
 ##########
 @@ -97,11 +106,18 @@ public void addEvent(Event event, IndexNameBuilder 
indexNameBuilder, String inde
     BytesReference content = serializer.getContentBuilder(event).bytes();
     Map<String, Map<String, String>> parameters = new HashMap<String, 
Map<String, String>>();
     Map<String, String> indexParameters = new HashMap<String, String>();
+    Map<String, String> headers = event.getHeaders();
     indexParameters.put(INDEX_PARAM, indexNameBuilder.getIndexName(event));
     indexParameters.put(TYPE_PARAM, indexType);
     if (ttlMs > 0) {
       indexParameters.put(TTL_PARAM, Long.toString(ttlMs));
     }
+    if (idHeaderName != null) {
+      String id = headers.get(idHeaderName);
+      if (id != null) {
+        indexParameters.put(ID_PARAM, id);
 
 Review comment:
   Note to reviewers: everything else in this PR exists to support this line.

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


With regards,
Apache Git Services

Reply via email to