Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1247#discussion_r236644723
  
    --- Diff: 
metron-platform/metron-elasticsearch/src/test/java/org/apache/metron/elasticsearch/integration/components/ElasticSearchComponent.java
 ---
    @@ -194,35 +215,41 @@ public Client getClient() {
         return client;
       }
     
    -  public BulkResponse add(String indexName, String sensorType, String... 
docs) throws IOException {
    +  public void add(UpdateDao updateDao, String indexName, String 
sensorType, String... docs)
    +          throws IOException, ParseException {
         List<String> d = new ArrayList<>();
         Collections.addAll(d, docs);
    -    return add(indexName, sensorType, d);
    +    add(updateDao, indexName, sensorType, d);
       }
     
    -  public BulkResponse add(String indexName, String sensorType, 
Iterable<String> docs)
    -      throws IOException {
    -    BulkRequestBuilder bulkRequest = getClient().prepareBulk();
    -    for (String doc : docs) {
    -      IndexRequestBuilder indexRequestBuilder = getClient()
    -          .prepareIndex(indexName, sensorType + "_doc");
    -
    -      indexRequestBuilder = indexRequestBuilder.setSource(doc);
    -      Map<String, Object> esDoc = JSONUtils.INSTANCE
    -          .load(doc, JSONUtils.MAP_SUPPLIER);
    -      indexRequestBuilder.setId((String) esDoc.get(Constants.GUID));
    -      Object ts = esDoc.get("timestamp");
    -      if (ts != null) {
    -        indexRequestBuilder = 
indexRequestBuilder.setTimestamp(ts.toString());
    -      }
    -      bulkRequest.add(indexRequestBuilder);
    -    }
    +  public void add(UpdateDao updateDao, String indexName, String 
sensorType, Iterable<String> docs)
    --- End diff --
    
    > Might it be better to just use IndexDao, which extends UpdateDao, 
SearchDao, RetrieveLatestDao, ColumnMetadataDao? 
    
    Why would that be better?  It needs to do updates, so it needs an 
`UpdateDao`.  Seemed logical to me.


---

Reply via email to