diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java index 3cd67f835ec..eec7064d1bd 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregator.java @@ -112,16 +112,16 @@ public class FiltersAggregator extends BucketsAggregator { @Override public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { - List buckets = new ArrayList<>(filters.length); + List buckets = new ArrayList<>(filters.length); for (int i = 0; i < keys.length; i++) { long bucketOrd = bucketOrd(owningBucketOrdinal, i); - InternalFilters.Bucket bucket = new InternalFilters.Bucket(keys[i], bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed); + InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(keys[i], bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed); buckets.add(bucket); } // other bucket if (showOtherBucket) { long bucketOrd = bucketOrd(owningBucketOrdinal, keys.length); - InternalFilters.Bucket bucket = new InternalFilters.Bucket(otherBucketKey, bucketDocCount(bucketOrd), + InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(otherBucketKey, bucketDocCount(bucketOrd), bucketAggregations(bucketOrd), keyed); buckets.add(bucket); } @@ -131,9 +131,9 @@ public class FiltersAggregator extends BucketsAggregator { @Override public InternalAggregation buildEmptyAggregation() { InternalAggregations subAggs = buildEmptySubAggregations(); - List buckets = new ArrayList<>(filters.length); + List buckets = new ArrayList<>(filters.length); for (int i = 0; i < keys.length; i++) { - InternalFilters.Bucket bucket = new InternalFilters.Bucket(keys[i], 0, subAggs, keyed); + InternalFilters.InternalBucket bucket = new InternalFilters.InternalBucket(keys[i], 0, subAggs, keyed); buckets.add(bucket); } return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metaData()); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/InternalFilters.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/InternalFilters.java index f685482636f..aed398d51df 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/InternalFilters.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/InternalFilters.java @@ -40,7 +40,7 @@ import java.util.Map; /** * */ -public class InternalFilters extends InternalMultiBucketAggregation implements Filters { +public class InternalFilters extends InternalMultiBucketAggregation implements Filters { public final static Type TYPE = new Type("filters"); @@ -53,16 +53,16 @@ public class InternalFilters extends InternalMultiBucketAggregation BUCKET_STREAM = new BucketStreams.Stream() { + private final static BucketStreams.Stream BUCKET_STREAM = new BucketStreams.Stream() { @Override - public Bucket readResult(StreamInput in, BucketStreamContext context) throws IOException { - Bucket filters = new Bucket(context.keyed()); + public InternalBucket readResult(StreamInput in, BucketStreamContext context) throws IOException { + InternalBucket filters = new InternalBucket(context.keyed()); filters.readFrom(in); return filters; } @Override - public BucketStreamContext getBucketStreamContext(Bucket bucket) { + public BucketStreamContext getBucketStreamContext(InternalBucket bucket) { BucketStreamContext context = new BucketStreamContext(); context.keyed(bucket.keyed); return context; @@ -74,19 +74,19 @@ public class InternalFilters extends InternalMultiBucketAggregation buckets, ReduceContext context) { - Bucket reduced = null; + InternalBucket reduce(List buckets, ReduceContext context) { + InternalBucket reduced = null; List aggregationsList = new ArrayList<>(buckets.size()); - for (Bucket bucket : buckets) { + for (InternalBucket bucket : buckets) { if (reduced == null) { - reduced = new Bucket(bucket.key, bucket.docCount, bucket.aggregations, bucket.keyed); + reduced = new InternalBucket(bucket.key, bucket.docCount, bucket.aggregations, bucket.keyed); } else { reduced.docCount += bucket.docCount; } @@ -156,13 +156,13 @@ public class InternalFilters extends InternalMultiBucketAggregation buckets; - private Map bucketMap; + private List buckets; + private Map bucketMap; private boolean keyed; public InternalFilters() {} // for serialization - public InternalFilters(String name, List buckets, boolean keyed, List pipelineAggregators, Map metaData) { + public InternalFilters(String name, List buckets, boolean keyed, List pipelineAggregators, Map metaData) { super(name, pipelineAggregators, metaData); this.buckets = buckets; this.keyed = keyed; @@ -174,25 +174,25 @@ public class InternalFilters extends InternalMultiBucketAggregation buckets) { + public InternalFilters create(List buckets) { return new InternalFilters(this.name, buckets, this.keyed, this.pipelineAggregators(), this.metaData); } @Override - public Bucket createBucket(InternalAggregations aggregations, Bucket prototype) { - return new Bucket(prototype.key, prototype.docCount, aggregations, prototype.keyed); + public InternalBucket createBucket(InternalAggregations aggregations, InternalBucket prototype) { + return new InternalBucket(prototype.key, prototype.docCount, aggregations, prototype.keyed); } @Override - public List getBuckets() { + public List getBuckets() { return buckets; } @Override - public Bucket getBucketByKey(String key) { + public InternalBucket getBucketByKey(String key) { if (bucketMap == null) { bucketMap = new HashMap<>(buckets.size()); - for (Bucket bucket : buckets) { + for (InternalBucket bucket : buckets) { bucketMap.put(bucket.getKey(), bucket); } } @@ -201,26 +201,26 @@ public class InternalFilters extends InternalMultiBucketAggregation aggregations, ReduceContext reduceContext) { - List> bucketsList = null; + List> bucketsList = null; for (InternalAggregation aggregation : aggregations) { InternalFilters filters = (InternalFilters) aggregation; if (bucketsList == null) { bucketsList = new ArrayList<>(filters.buckets.size()); - for (Bucket bucket : filters.buckets) { - List sameRangeList = new ArrayList<>(aggregations.size()); + for (InternalBucket bucket : filters.buckets) { + List sameRangeList = new ArrayList<>(aggregations.size()); sameRangeList.add(bucket); bucketsList.add(sameRangeList); } } else { int i = 0; - for (Bucket bucket : filters.buckets) { + for (InternalBucket bucket : filters.buckets) { bucketsList.get(i++).add(bucket); } } } - InternalFilters reduced = new InternalFilters(name, new ArrayList(bucketsList.size()), keyed, pipelineAggregators(), getMetaData()); - for (List sameRangeList : bucketsList) { + InternalFilters reduced = new InternalFilters(name, new ArrayList(bucketsList.size()), keyed, pipelineAggregators(), getMetaData()); + for (List sameRangeList : bucketsList) { reduced.buckets.add((sameRangeList.get(0)).reduce(sameRangeList, reduceContext)); } return reduced; @@ -230,9 +230,9 @@ public class InternalFilters extends InternalMultiBucketAggregation buckets = new ArrayList<>(size); + List buckets = new ArrayList<>(size); for (int i = 0; i < size; i++) { - Bucket bucket = new Bucket(keyed); + InternalBucket bucket = new InternalBucket(keyed); bucket.readFrom(in); buckets.add(bucket); } @@ -244,7 +244,7 @@ public class InternalFilters extends InternalMultiBucketAggregation 0) { assertThat(docCountDeriv, notNullValue()); @@ -224,7 +224,7 @@ public class DerivativeIT extends ESIntegTestCase { for (int i = 0; i < numValueBuckets; ++i) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]); Derivative docCountDeriv = bucket.getAggregations().get("deriv"); if (i > 0) { assertThat(docCountDeriv, notNullValue()); @@ -267,7 +267,7 @@ public class DerivativeIT extends ESIntegTestCase { // overwritten for (int i = 0; i < numValueBuckets; ++i) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]); Sum sum = bucket.getAggregations().get("sum"); assertThat(sum, notNullValue()); long expectedSum = valueCounts[i] * (i * interval); @@ -312,7 +312,7 @@ public class DerivativeIT extends ESIntegTestCase { // overwritten for (int i = 0; i < numValueBuckets; ++i) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]); Stats stats = bucket.getAggregations().get("stats"); assertThat(stats, notNullValue()); long expectedSum = valueCounts[i] * (i * interval); @@ -366,7 +366,7 @@ public class DerivativeIT extends ESIntegTestCase { for (int i = 0; i < numValueBuckets; ++i) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i * interval, valueCounts[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i * interval, valueCounts[i]); SimpleValue docCountDeriv = bucket.getAggregations().get("deriv"); if (i > 0) { assertThat(docCountDeriv, notNullValue()); @@ -395,7 +395,7 @@ public class DerivativeIT extends ESIntegTestCase { for (int i = 0; i < valueCounts_empty.length; i++) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty[i]); SimpleValue docCountDeriv = bucket.getAggregations().get("deriv"); if (firstDerivValueCounts_empty[i] == null) { assertThat(docCountDeriv, nullValue()); @@ -425,7 +425,7 @@ public class DerivativeIT extends ESIntegTestCase { for (int i = 0; i < valueCounts_empty_rnd.length; i++) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty_rnd[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty_rnd[i]); SimpleValue docCountDeriv = bucket.getAggregations().get("deriv"); if (firstDerivValueCounts_empty_rnd[i] == null) { assertThat(docCountDeriv, nullValue()); @@ -454,7 +454,7 @@ public class DerivativeIT extends ESIntegTestCase { for (int i = 0; i < valueCounts_empty.length; i++) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i + ": ", bucket, i, valueCounts_empty[i]); + checkBucketKeyAndDocCount("InternalBucket " + i + ": ", bucket, i, valueCounts_empty[i]); SimpleValue docCountDeriv = bucket.getAggregations().get("deriv"); if (firstDerivValueCounts_empty[i] == null) { assertThat(docCountDeriv, nullValue()); @@ -484,7 +484,7 @@ public class DerivativeIT extends ESIntegTestCase { double lastSumValue = Double.NaN; for (int i = 0; i < valueCounts_empty.length; i++) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty[i]); Sum sum = bucket.getAggregations().get("sum"); double thisSumValue = sum.value(); if (bucket.getDocCount() == 0) { @@ -526,7 +526,7 @@ public class DerivativeIT extends ESIntegTestCase { double lastSumValue = Double.NaN; for (int i = 0; i < valueCounts_empty.length; i++) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty[i]); Sum sum = bucket.getAggregations().get("sum"); double thisSumValue = sum.value(); if (bucket.getDocCount() == 0) { @@ -565,7 +565,7 @@ public class DerivativeIT extends ESIntegTestCase { double lastSumValue = Double.NaN; for (int i = 0; i < valueCounts_empty_rnd.length; i++) { Histogram.Bucket bucket = buckets.get(i); - checkBucketKeyAndDocCount("Bucket " + i, bucket, i, valueCounts_empty_rnd[i]); + checkBucketKeyAndDocCount("InternalBucket " + i, bucket, i, valueCounts_empty_rnd[i]); Sum sum = bucket.getAggregations().get("sum"); double thisSumValue = sum.value(); if (bucket.getDocCount() == 0) { diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java index 760968b0bf3..612f8a9eea7 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3Repository.java @@ -85,7 +85,7 @@ public class S3Repository extends BlobStoreRepository { String region = repositorySettings.settings().get("region", settings.get(REPOSITORY_S3.REGION)); if (region == null) { - // Bucket setting is not set - use global region setting + // InternalBucket setting is not set - use global region setting String regionSetting = settings.get(CLOUD_AWS.REGION); if (regionSetting != null) { regionSetting = regionSetting.toLowerCase(Locale.ENGLISH);