Skip to content

Commit

Permalink
Merge pull request #10 from rahul1193/rahul/rest-client-1.4.1
Browse files Browse the repository at this point in the history
double terms fix
  • Loading branch information
brandonkearby authored Jan 19, 2017
2 parents 17647fc + 6ffc0e8 commit b671e8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>1.4.1-rest-1.0.33</version>
<version>1.4.1-rest-1.0.34</version>
<packaging>jar</packaging>
<description>Elasticsearch - Open Source, Distributed, RESTful Search Engine</description>
<inceptionYear>2009</inceptionYear>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.elasticsearch.search.aggregations.bucket.terms;

import com.google.common.collect.Lists;
import org.elasticsearch.Version;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput;
Expand All @@ -28,6 +29,7 @@
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentObject;
import org.elasticsearch.search.aggregations.AggregationStreams;
import org.elasticsearch.search.aggregations.CommonJsonField;
import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.support.format.ValueFormatter;
Expand Down Expand Up @@ -65,6 +67,20 @@ public static void registerStreams() {
AggregationStreams.registerStream(STREAM, TYPE.stream());
}

@Override
public void readFrom(XContentObject in) throws IOException {
this.name = in.get(CommonJsonField._name);
List<XContentObject> bucketsXContent = in.getAsXContentObjectsOrEmpty(CommonJsonField.buckets);
List<InternalTerms.Bucket> buckets = Lists.newArrayListWithCapacity(bucketsXContent.size());
for (XContentObject xBucket : bucketsXContent) {
InternalAggregations aggregations = InternalAggregations.readAggregations(xBucket);
long bucketDocCountError = xBucket.getAsLong(InternalTerms.DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME, 0L);
buckets.add(new DoubleTerms.Bucket(xBucket.getAsDouble(CommonJsonField.key), xBucket.getAsLong(CommonJsonField.doc_count), aggregations, showTermDocCountError, bucketDocCountError));
}
this.buckets = buckets;
this.bucketMap = null;
}

static class Bucket extends InternalTerms.Bucket {

double term;
Expand Down

0 comments on commit b671e8c

Please sign in to comment.