Skip to content
This repository has been archived by the owner on May 22, 2018. It is now read-only.

Commit

Permalink
fix(elasticsearch): Update ES query with a valid size and correct format
Browse files Browse the repository at this point in the history
  • Loading branch information
brasseld committed May 30, 2017
1 parent 6dcc775 commit 6ee77ab
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public HealthResponse query(String api, long interval, long from, long to) throw
.field(FIELD_TIMESTAMP)
.interval(interval);

byDateAggregation.subAggregation(terms("by_result").field(FIELD_HEALTH_RESPONSE_SUCCESS).size(0));
byDateAggregation.subAggregation(terms("by_result").field(FIELD_HEALTH_RESPONSE_SUCCESS));

// And set aggregation to the request
requestBuilder.addAggregation(byDateAggregation);
Expand Down Expand Up @@ -111,11 +111,11 @@ private HealthResponse toHealthResponse(SearchResponse searchResponse) {

for (Terms.Bucket termBucket : terms.getBuckets()) {
long [] valuesByStatus = values.getOrDefault(
Integer.parseInt(termBucket.getKeyAsString()) == 1, new long[timestamps.length]);
Boolean.parseBoolean(termBucket.getKeyAsString()), new long[timestamps.length]);

valuesByStatus[idx] = termBucket.getDocCount();

values.put(Integer.parseInt(termBucket.getKeyAsString()) == 1, valuesByStatus);
values.put(Boolean.parseBoolean(termBucket.getKeyAsString()), valuesByStatus);
}

idx++;
Expand Down

0 comments on commit 6ee77ab

Please sign in to comment.