private HistogramAggregationBuilder histogram(MethodField field) throws SqlParseException { String aggName = gettAggNameFromParamsOrAlias(field); HistogramAggregationBuilder histogram = AggregationBuilders.histogram(aggName); String value = null; for (KVValue kv : field.getParams()) {
@JsonIgnore @Override public HistogramAggregationBuilder getEsAggregate() { HistogramAggregationBuilder ret = AggregationBuilders.histogram(getId()).field(getField()); Map<String, String> props = getProperties(); ret.interval(getInterval());
private HistogramAggregationBuilder histogram(MethodField field) throws SqlParseException { String aggName = gettAggNameFromParamsOrAlias(field); HistogramAggregationBuilder histogram = AggregationBuilders.histogram(aggName); String value = null; for (KVValue kv : field.getParams()) {
baseQuery(boundaryFilter) .addAggregation( AggregationBuilders.histogram("xField") .field(this.xField) .interval(getHistogramIntervalFromBounds(startX, endX)) .minDocCount(1) .subAggregation( AggregationBuilders.histogram("yField") .field(this.yField) .interval(getHistogramIntervalFromBounds(endY, startY))
private double searchForMaxBucketValue(double intervalX, double intervalY) { // build a query with a 2d aggregation on the xField and yField // change the interval SearchRequestBuilder metaDataQuery = this.client.prepareSearch(this.index) .setTypes("datum") .setSearchType(SearchType.COUNT) .addAggregation( AggregationBuilders.histogram("xAgg") .field(this.xField) .interval((long) intervalX) .order(Histogram.Order.COUNT_DESC) .subAggregation( AggregationBuilders.histogram("yAgg") .field(this.yField) .interval((long) intervalY) .order(Histogram.Order.COUNT_DESC) ) ); SearchResponse searchResponse = metaDataQuery.execute().actionGet(); Histogram agg = searchResponse.getAggregations().get("xAgg"); return getMaxValueFrom2DHistogram(agg); }
HistogramAggregationBuilder histogramAgg = AggregationBuilders.histogram(aggName); histogramAgg.field(propertyName); histogramAgg.interval(Double.parseDouble(agg.getInterval()));
HistogramAggregationBuilder histogramAgg = AggregationBuilders.histogram(aggName); histogramAgg.field(propertyName); histogramAgg.interval(Double.parseDouble(agg.getInterval()));
String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); if (propertyDataType == Date.class) { HistogramAggregationBuilder histAgg = AggregationBuilders.histogram(aggName); histAgg.interval(1); if (agg.getMinDocumentCount() != null) {
String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); if (propertyDataType == Date.class) { HistogramAggregationBuilder histAgg = AggregationBuilders.histogram(aggName); histAgg.interval(1); if (agg.getMinDocumentCount() != null) {
HistogramBuilder histogramAgg = AggregationBuilders.histogram(aggName); histogramAgg.field(propertyName); histogramAgg.interval(Long.parseLong(agg.getInterval()));
private Collection<? extends AbstractAggregationBuilder> getElasticsearchCalendarFieldAggregation(CalendarFieldAggregation agg) { List<AggregationBuilder> aggs = new ArrayList<>(); PropertyDefinition propertyDefinition = getPropertyDefinition(agg.getPropertyName()); if (propertyDefinition == null) { throw new VertexiumException("Could not find mapping for property: " + agg.getPropertyName()); } Class propertyDataType = propertyDefinition.getDataType(); for (String propertyName : getPropertyNames(agg.getPropertyName())) { String visibilityHash = getSearchIndex().getPropertyVisibilityHashFromDeflatedPropertyName(propertyName); String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); if (propertyDataType == Date.class) { HistogramBuilder histAgg = AggregationBuilders.histogram(aggName); histAgg.interval(1); if (agg.getMinDocumentCount() != null) { histAgg.minDocCount(agg.getMinDocumentCount()); } String script = getCalendarFieldAggregationScript(agg, propertyName); histAgg.script(script); for (AbstractAggregationBuilder subAgg : getElasticsearchAggregations(agg.getNestedAggregations())) { histAgg.subAggregation(subAgg); } aggs.add(histAgg); } else { throw new VertexiumException("Only dates are supported for hour of day aggregations"); } } return aggs; }
private Collection<? extends AbstractAggregationBuilder> getElasticsearchCalendarFieldAggregation(CalendarFieldAggregation agg) { List<AggregationBuilder> aggs = new ArrayList<>(); PropertyDefinition propertyDefinition = getPropertyDefinition(agg.getPropertyName()); if (propertyDefinition == null) { throw new VertexiumException("Could not find mapping for property: " + agg.getPropertyName()); } Class propertyDataType = propertyDefinition.getDataType(); for (String propertyName : getPropertyNames(agg.getPropertyName())) { String visibilityHash = getSearchIndex().getPropertyVisibilityHashFromDeflatedPropertyName(propertyName); String aggName = createAggregationName(agg.getAggregationName(), visibilityHash); if (propertyDataType == Date.class) { HistogramBuilder histAgg = AggregationBuilders.histogram(aggName); histAgg.interval(1); if (agg.getMinDocumentCount() != null) { histAgg.minDocCount(agg.getMinDocumentCount()); } else { histAgg.minDocCount(1L); } Script script = new Script(getCalendarFieldAggregationScript(agg, propertyName)); histAgg.script(script); for (AbstractAggregationBuilder subAgg : getElasticsearchAggregations(agg.getNestedAggregations())) { histAgg.subAggregation(subAgg); } aggs.add(histAgg); } else { throw new VertexiumException("Only dates are supported for hour of day aggregations"); } } return aggs; }
.addAggregation(AggregationBuilders.terms("methods").field("method")) .addAggregation( AggregationBuilders.histogram("response_time_histogram").field("timeTaken").interval(100)) .addAggregation(AggregationBuilders.extendedStats("response_time_stats").field("timeTaken")) .addAggregation(AggregationBuilders.terms("response_status_stats").field("response.status"))
HistogramBuilder histogramAgg = AggregationBuilders.histogram(aggName); histogramAgg.field(propertyName); histogramAgg.interval(Long.parseLong(agg.getInterval()));
searchRequestBuilder.addAggregation(agg); } else { HistogramBuilder agg = AggregationBuilders.histogram(histogramQueryItem.getAggregationName()); agg.field(histogramQueryItem.getFieldName()); agg.interval(Long.parseLong(histogramQueryItem.getInterval()));
searchRequestBuilder.addAggregation(agg); } else { HistogramBuilder agg = AggregationBuilders.histogram(histogramQueryItem.getAggregationName()); agg.field(histogramQueryItem.getFieldName()); agg.interval(Long.parseLong(histogramQueryItem.getInterval()));
searchRequestBuilder.addAggregation(agg); } else { HistogramBuilder agg = AggregationBuilders.histogram(histogramQueryItem.getAggregationName()); agg.field(histogramQueryItem.getFieldName()); agg.interval(Long.parseLong(histogramQueryItem.getInterval()));
searchRequestBuilder.addAggregation(agg); } else { HistogramBuilder agg = AggregationBuilders.histogram(histogramQueryItem.getAggregationName()); agg.field(histogramQueryItem.getFieldName()); agg.interval(Long.parseLong(histogramQueryItem.getInterval()));