metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject metron git commit: METRON-1497 Rest endpoint '/api/v1/search/search' needs to handle null when elastic search response return null for getAggregations (MohanDV via justinleet) closes apache/metron#968
Date Tue, 03 Apr 2018 14:27:18 GMT
Repository: metron
Updated Branches:
  refs/heads/master 9e95d4b61 -> 19b237de2


METRON-1497 Rest endpoint '/api/v1/search/search' needs to handle null when elastic search
response return null for getAggregations (MohanDV via justinleet) closes apache/metron#968


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/19b237de
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/19b237de
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/19b237de

Branch: refs/heads/master
Commit: 19b237de27eed37ee87eca6d8e2198083fdb88d7
Parents: 9e95d4b
Author: MohanDV <mohan.dv@gmail.com>
Authored: Tue Apr 3 10:25:52 2018 -0400
Committer: leet <leet@apache.org>
Committed: Tue Apr 3 10:25:52 2018 -0400

----------------------------------------------------------------------
 .../apache/metron/elasticsearch/dao/ElasticsearchDao.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/19b237de/metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
b/metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
index 9bb109d..26e5731 100644
--- a/metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
+++ b/metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
@@ -608,10 +608,12 @@ public class ElasticsearchDao implements IndexDao {
     Map<String, Map<String, Long>> fieldCounts = new HashMap<>();
     for (String field: fields) {
       Map<String, Long> valueCounts = new HashMap<>();
-      Aggregation aggregation = aggregations.get(getFacetAggregationName(field));
-      if (aggregation instanceof Terms) {
-        Terms terms = (Terms) aggregation;
-        terms.getBuckets().stream().forEach(bucket -> valueCounts.put(formatKey(bucket.getKey(),
commonColumnMetadata.get(field)), bucket.getDocCount()));
+      if(aggregations != null ){
+        Aggregation aggregation = aggregations.get(getFacetAggregationName(field));
+        if (aggregation instanceof Terms) {
+          Terms terms = (Terms) aggregation;
+          terms.getBuckets().stream().forEach(bucket -> valueCounts.put(formatKey(bucket.getKey(),
commonColumnMetadata.get(field)), bucket.getDocCount()));
+        }
       }
       fieldCounts.put(field, valueCounts);
     }


Mime
View raw message