public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = entry.getValue().doubleValue(); final double value = Double.parseDouble(entry.getKey()); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentileRanksImpl(name, builder.build()); }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = Double.parseDouble(entry.getKey()); final double value = entry.getValue().doubleValue(); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentilesImpl(name, builder.build()); }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { // TODO figure out some way to reconstruct the t-digest, or send PR with option to serialize the t-digest in the response. final Map<String, Number> values = nodeMapValue(map.get("values"), String.class, Number.class); final ImmutableList.Builder<Percentile> builder = ImmutableList.builder(); for (Map.Entry<String, Number> entry : values.entrySet()) { final double percent = entry.getValue().doubleValue(); final double value = Double.parseDouble(entry.getKey()); builder.add(new InternalPercentile(percent, value)); } return new ApproximatePercentileRanksImpl(name, builder.build()); }
private static InternalDateRange internalKeyedRange(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalDateRange.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(DateRangeBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new InternalDateRange(name, buckets.build(), ValueFormatter.RAW, true); }
private static InternalRange<InternalRange.Bucket> internalKeyedRange(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalRange.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(RangeBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new InternalRange<InternalRange.Bucket>(name, buckets.build(), ValueFormatter.RAW, true); } }
private static InternalGeoDistance internalKeyedRange(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalGeoDistance.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(GeoDistanceBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new InternalGeoDistance(name, buckets.build(), ValueFormatter.RAW, true); } }
private static InternalAggregation internalKeyedHistogram(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<Histogram.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(HistogramBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new ComputedHistogram(name, buckets.build()); }
private static InternalDateRange internalKeyedRange(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalDateRange.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(DateRangeBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new InternalDateRange(name, buckets.build(), ValueFormatter.RAW, true); }
private static InternalIPv4Range internalKeyedRange(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalIPv4Range.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(IPv4RangeBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new InternalIPv4Range(name, buckets.build(), true); }
private static InternalAggregation internalKeyedHistogram(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<Histogram.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(HistogramBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new ComputedHistogram(name, buckets.build()); }
private static InternalAggregation internalKeyedFilters(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalGeoHashGrid.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(GeoHashGridBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } final int requiredSize = -1; return new InternalGeoHashGrid(name, requiredSize, buckets.build()); }
private static InternalRange<InternalRange.Bucket> internalKeyedRange(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalRange.Bucket> buckets = ImmutableList.builder(); for (Map.Entry<String, Object> bucketObj : map.entrySet()) { final String bucketName = bucketObj.getKey(); final Map<String, Object> bucketMap = nodeMapValue(bucketObj.getValue(), String.class, Object.class); buckets.add(RangeBucketHelper.fromXContent(bucketName, bucketMap, manifest)); } return new InternalRange<InternalRange.Bucket>(name, buckets.build(), ValueFormatter.RAW, true); } }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final long docCount = nodeLongValue(map.get("doc_count")); final List<Object> bucketObjs = nodeListValue(map.get("buckets"), Object.class); final ImmutableList.Builder<SignificantTerms.Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : bucketObjs) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(SignificantTermsBucketHelper.fromXContent(docCount, bucketMap, manifest)); } return new ComputedSignificantTerms(name, buckets.build()); }
public static InternalAggregation fromXContent(final String name, final Map<String, Object> map, final AggregationsManifest manifest) { final long docCount = nodeLongValue(map.get("doc_count")); final List<Object> bucketObjs = nodeListValue(map.get("buckets"), Object.class); final ImmutableList.Builder<SignificantTerms.Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : bucketObjs) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(SignificantTermsBucketHelper.fromXContent(docCount, bucketMap, manifest)); } return new ComputedSignificantTerms(name, buckets.build()); }
private static InternalGeoDistance internalAnonRange(final String name, final List<Object> list, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalGeoDistance.Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : list) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(GeoDistanceBucketHelper.fromXContent(null, bucketMap, manifest)); } // In the current implementation, the bucket will always have a key (because it generates one if it's missing). // Also, possibly because the Java api cannot ask for a "keyed" range agg, ES is always giving back // a list, even when we specify keys. // I'm thinking there's no downside to always saying the range is keyed, since you can still just do getBuckets if you don't know the keys. return new InternalGeoDistance(name, buckets.build(), ValueFormatter.RAW, true); }
private void remove(String name, List<JobEvent> values, JobEvent status) throws IOException { Builder<JobEvent> updatedValues = ImmutableList.builder(); for (JobEvent value : values) { if (!value.equals(status)) { updatedValues.add(value); } } String value = generateSetting(updatedValues.build()); updateSetting(name, value); }
private static InternalAggregation internalAnonFilters(final String name, final List<Object> list, final AggregationsManifest manifest) { final ImmutableList.Builder<Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : list) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(FiltersBucketHelper.fromXContent(null, bucketMap, manifest)); } return new InternalFilters(name, buckets.build(), false); } }
private static InternalAggregation internalAnonFilters(final String name, final List<Object> list, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalGeoHashGrid.Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : list) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(GeoHashGridBucketHelper.fromXContent(null, bucketMap, manifest)); } final int requiredSize = -1; return new InternalGeoHashGrid(name, requiredSize, buckets.build()); } }
private static InternalAggregation internalAnonFilters(final String name, final List<Object> list, final AggregationsManifest manifest) { final ImmutableList.Builder<InternalGeoHashGrid.Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : list) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(GeoHashGridBucketHelper.fromXContent(null, bucketMap, manifest)); } final int requiredSize = -1; return new InternalGeoHashGrid(name, requiredSize, buckets.build()); } }
private static InternalAggregation internalAnonHistogram(final String name, final List<Object> list, final AggregationsManifest manifest) { final ImmutableList.Builder<Histogram.Bucket> buckets = ImmutableList.builder(); for (Object bucketObj : list) { final Map<String, Object> bucketMap = nodeMapValue(bucketObj, String.class, Object.class); buckets.add(HistogramBucketHelper.fromXContent(null, bucketMap, manifest)); } return new ComputedHistogram(name, buckets.build()); }