Search in sources :

Example 6 with GroupResult

use of org.apache.metron.indexing.dao.search.GroupResult in project metron by apache.

the class InMemoryDao method getGroupResults.

private List<GroupResult> getGroupResults(List<Group> groups, int index) {
    Group group = groups.get(index);
    GroupResult groupResult = new GroupResult();
    groupResult.setKey(group.getField() + "_value");
    if (index < groups.size() - 1) {
        groupResult.setGroupedBy(groups.get(index + 1).getField());
        groupResult.setGroupResults(getGroupResults(groups, index + 1));
    } else {
        groupResult.setScore(50.0);
    }
    groupResult.setTotal(10);
    return Collections.singletonList(groupResult);
}
Also used : Group(org.apache.metron.indexing.dao.search.Group) GroupResult(org.apache.metron.indexing.dao.search.GroupResult)

Aggregations

GroupResult (org.apache.metron.indexing.dao.search.GroupResult)6 GroupRequest (org.apache.metron.indexing.dao.search.GroupRequest)4 GroupResponse (org.apache.metron.indexing.dao.search.GroupResponse)4 Test (org.junit.Test)4 Group (org.apache.metron.indexing.dao.search.Group)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ElasticsearchDao (org.apache.metron.elasticsearch.dao.ElasticsearchDao)1 GetRequest (org.apache.metron.indexing.dao.search.GetRequest)1 Terms (org.elasticsearch.search.aggregations.bucket.terms.Terms)1 Bucket (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket)1 Sum (org.elasticsearch.search.aggregations.metrics.sum.Sum)1