Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(usage statistics): populate the email field #3244

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ private List<UserUsageCounts> getUserUsageCounts(Filter filter) {
// Sum aggregation on userCounts.count
AggregationSpec sumUserCountsCountAggSpec =
new AggregationSpec().setAggregationType(AggregationType.SUM).setFieldPath("userCounts.count");
AggregationSpec[] aggregationSpecs = new AggregationSpec[]{sumUserCountsCountAggSpec};
AggregationSpec latestUserEmailAggSpec =
new AggregationSpec().setAggregationType(AggregationType.LATEST).setFieldPath("userCounts.userEmail");
AggregationSpec[] aggregationSpecs = new AggregationSpec[]{sumUserCountsCountAggSpec, latestUserEmailAggSpec};

// String grouping bucket on userCounts.user
GroupingBucket userGroupingBucket =
Expand All @@ -223,6 +225,9 @@ private List<UserUsageCounts> getUserUsageCounts(Filter filter) {
throw new IllegalArgumentException("Failed to convert user usage count from ES to int", e);
}
}
if (!row.get(2).equals(ES_NULL_VALUE)) {
userUsageCount.setUserEmail(row.get(2));
}
userUsageCounts.add(userUsageCount);
}
return userUsageCounts;
Expand Down