metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From merrimanr <>
Subject [GitHub] metron pull request #677: METRON-1073: Add option to limit fields returned f...
Date Wed, 23 Aug 2017 20:21:52 GMT
Github user merrimanr commented on a diff in the pull request:
    --- Diff: metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/
    @@ -100,7 +107,16 @@ public SearchResponse search(SearchRequest searchRequest) throws
-> {
           SearchResult searchResult = new SearchResult();
    -      searchResult.setSource(searchHit.getSource());
    +      Map<String, Object> source;
    +      if (fields.isPresent()) {
    +        source = new HashMap<>();
    +        searchHit.getFields().forEach((key, value) -> {
    +          source.put(key, value.getValues().size() == 1 ? value.getValue() : value.getValues());
    --- End diff --
    If there are no results this line doesn't even get called because this code is inside
a Stream map function that's iterating over the results.  The test case is really simple though
so I added it just to be sure.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message