Github user mmiklavc commented on a diff in the pull request:
https://github.com/apache/metron/pull/677#discussion_r134839995
--- Diff:
metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java
---
@@ -100,7 +107,16 @@ public SearchResponse search(SearchRequest
searchRequest) throws InvalidSearchEx
searchResponse.setResults(Arrays.stream(elasticsearchResponse.getHits().getHits()).map(searchHit
-> {
SearchResult searchResult = new SearchResult();
searchResult.setId(searchHit.getId());
- 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 --
@merrimanr Do you have an integration test that checks when the result size
is 0? I didn't notice one. I'm not familiar enough with
`value.getValues().size()` to know how this works for boundary conditions. The
ES javadoc doesn't really provide details.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---