if(kv.value.toString().contains("doc[")) { String script = kv.value + "; return " + kv.key; histogram.script(new Script(script)); } else { value = kv.value.toString(); switch (kv.key.toLowerCase()) { case "interval": histogram.interval(Long.parseLong(value)); break; case "field": histogram.field(value); break; case "min_doc_count": histogram.minDocCount(Long.parseLong(value)); break; case "extended_bounds": String[] bounds = value.split(":"); if (bounds.length == 2) histogram.extendedBounds(Long.valueOf(bounds[0]), Long.valueOf(bounds[1])); break; case "alias": break; histogram.order(order); break; default:
/** * Create a new {@link Histogram} aggregation with the given name. */ public static HistogramAggregationBuilder histogram(String name) { return new HistogramAggregationBuilder(name); }
} else { HistogramAggregationBuilder histogramAgg = AggregationBuilders.histogram(aggName); histogramAgg.field(propertyName); histogramAgg.interval(Double.parseDouble(agg.getInterval())); histogramAgg.minDocCount(1L); if (agg.getMinDocumentCount() != null) { histogramAgg.minDocCount(agg.getMinDocumentCount()); histogramAgg.extendedBounds((Long) bounds.getMin(), (Long) bounds.getMax()); } else if (bounds.getMinMaxType().isAssignableFrom(Double.class)) { histogramAgg.extendedBounds((Double) bounds.getMin(), (Double) bounds.getMax()); } else { throw new VertexiumException("Unhandled extended bounds type. Expected Double or Long. Found: " + bounds.getMinMaxType().getName()); histogramAgg.subAggregation(subAgg);
if (propertyDataType == Date.class) { HistogramAggregationBuilder histAgg = AggregationBuilders.histogram(aggName); histAgg.interval(1); if (agg.getMinDocumentCount() != null) { histAgg.minDocCount(agg.getMinDocumentCount()); } else { histAgg.minDocCount(1L); "calendarField", agg.getCalendarField()) ); histAgg.script(script); histAgg.subAggregation(subAgg);
/** * Sets the order in which the buckets will be returned. A tie-breaker may be added to avoid non-deterministic * ordering. */ public HistogramAggregationBuilder order(List<BucketOrder> orders) { if (orders == null) { throw new IllegalArgumentException("[orders] must not be null: [" + name + "]"); } // if the list only contains one order use that to avoid inconsistent xcontent order(orders.size() > 1 ? BucketOrder.compound(orders) : orders.get(0)); return this; }
} else { HistogramAggregationBuilder histogramAgg = AggregationBuilders.histogram(aggName); histogramAgg.field(propertyName); histogramAgg.interval(Double.parseDouble(agg.getInterval())); histogramAgg.minDocCount(1L); if (agg.getMinDocumentCount() != null) { histogramAgg.minDocCount(agg.getMinDocumentCount()); histogramAgg.extendedBounds((Long) bounds.getMin(), (Long) bounds.getMax()); } else if (bounds.getMinMaxType().isAssignableFrom(Double.class)) { histogramAgg.extendedBounds((Double) bounds.getMin(), (Double) bounds.getMax()); } else { throw new VertexiumException("Unhandled extended bounds type. Expected Double or Long. Found: " + bounds.getMinMaxType().getName()); histogramAgg.subAggregation(subAgg);
if (propertyDataType == Date.class) { HistogramAggregationBuilder histAgg = AggregationBuilders.histogram(aggName); histAgg.interval(1); if (agg.getMinDocumentCount() != null) { histAgg.minDocCount(agg.getMinDocumentCount()); } else { histAgg.minDocCount(1L); "calendarField", agg.getCalendarField()) ); histAgg.script(script); histAgg.subAggregation(subAgg);
/** * Sets the order in which the buckets will be returned. A tie-breaker may be added to avoid non-deterministic * ordering. */ public HistogramAggregationBuilder order(List<BucketOrder> orders) { if (orders == null) { throw new IllegalArgumentException("[orders] must not be null: [" + name + "]"); } // if the list only contains one order use that to avoid inconsistent xcontent order(orders.size() > 1 ? BucketOrder.compound(orders) : orders.get(0)); return this; }
@JsonIgnore @Override public HistogramAggregationBuilder getEsAggregate() { HistogramAggregationBuilder ret = AggregationBuilders.histogram(getId()).field(getField()); Map<String, String> props = getProperties(); ret.interval(getInterval()); if (props.containsKey(AGG_MIN_DOC_COUNT_PROP)) { ret.minDocCount(Long.parseLong(props.get(AGG_MIN_DOC_COUNT_PROP))); ret.order(BucketOrder.count(false)); break; case AGG_ORDER_COUNT_ASC: ret.order(BucketOrder.count(true)); break; case AGG_ORDER_KEY_DESC: ret.order(BucketOrder.key(false)); break; case AGG_ORDER_KEY_ASC: ret.order(BucketOrder.key(true)); break; default: ret.extendedBounds(Long.parseLong(props.get(AGG_EXTENDED_BOUND_MIN_PROP)), Long.parseLong(props.get(AGG_EXTENDED_BOUND_MAX_PROP)));
@Override protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) { return new HistogramAggregationBuilder(this, factoriesBuilder, metaData); }
/** * Sets the order in which the buckets will be returned. A tie-breaker may be added to avoid non-deterministic * ordering. */ public HistogramAggregationBuilder order(List<BucketOrder> orders) { if (orders == null) { throw new IllegalArgumentException("[orders] must not be null: [" + name + "]"); } // if the list only contains one order use that to avoid inconsistent xcontent order(orders.size() > 1 ? BucketOrder.compound(orders) : orders.get(0)); return this; }
switch (kv.key.toLowerCase()) { case "interval": histogram.interval(Long.parseLong(value)); break; case "field": histogram.field(value); break; case "min_doc_count": histogram.minDocCount(Long.parseLong(value)); break; case "extended_bounds": String[] bounds = value.split(":"); if (bounds.length == 2) histogram.extendedBounds(Long.valueOf(bounds[0]), Long.valueOf(bounds[1])); break; case "alias": break; histogram.order(order); break; default:
public static HistogramAggregationBuilder parse(String aggregationName, XContentParser parser) throws IOException { return PARSER.parse(parser, new HistogramAggregationBuilder(aggregationName), null); }
/** * Create a new {@link Histogram} aggregation with the given name. */ public static HistogramAggregationBuilder histogram(String name) { return new HistogramAggregationBuilder(name); }
/** * Create a new {@link Histogram} aggregation with the given name. */ public static HistogramAggregationBuilder histogram(String name) { return new HistogramAggregationBuilder(name); }
/** * Create a new {@link Histogram} aggregation with the given name. */ public static HistogramAggregationBuilder histogram(String name) { return new HistogramAggregationBuilder(name); }
@Override protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) { return new HistogramAggregationBuilder(this, factoriesBuilder, metaData); }
@Override protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) { return new HistogramAggregationBuilder(this, factoriesBuilder, metaData); }
public static HistogramAggregationBuilder parse(String aggregationName, XContentParser parser) throws IOException { return PARSER.parse(parser, new HistogramAggregationBuilder(aggregationName), null); }
public static HistogramAggregationBuilder parse(String aggregationName, XContentParser parser) throws IOException { return PARSER.parse(parser, new HistogramAggregationBuilder(aggregationName), null); }