Examples of HistogramResult


Examples of org.graylog2.indexer.results.HistogramResult

        if (!isNullOrEmpty(streamId)) {
            filter = "streams:" + streamId;
        }

        try {
            final HistogramResult histogramResult = searches.fieldHistogram(
                    query,
                    (String) config.get("field"),
                    Searches.DateHistogramInterval.valueOf(((String) config.get("interval")).toUpperCase()),
                    filter,
                    timeRange
            );

            return new ComputationResult(histogramResult.getResults(), histogramResult.took().millis(), histogramResult.getHistogramBoundaries());
        } catch (Searches.FieldTypeException e) {
            String msg = "Could not calculate [" + this.getClass().getCanonicalName() + "] widget <" + getId() + ">. Not a numeric field? The field was [" + config.get("field") + "]";
            LOG.error(msg, e);
            throw new RuntimeException(msg);
        } catch (IndexHelper.InvalidRangeFormatException e) {
View Full Code Here

Examples of org.graylog2.indexer.results.HistogramResult

        if (!isNullOrEmpty(streamId)) {
            filter = "streams:" + streamId;
        }

        try {
            HistogramResult histogram = searches.histogram(query, interval, filter, timeRange);
            return new ComputationResult(histogram.getResults(), histogram.took().millis(), histogram.getHistogramBoundaries());
        } catch (IndexHelper.InvalidRangeFormatException e) {
            throw new RuntimeException("Invalid timerange format.", e);
        }
    }
View Full Code Here

Examples of org.springframework.data.elasticsearch.core.facet.result.HistogramResult

    // when
    FacetedPage<LogEntity> result = elasticsearchTemplate.queryForPage(searchQuery, LogEntity.class);
    // then
    assertThat(result.getNumberOfElements(), is(equalTo(4)));

    HistogramResult facet = (HistogramResult) result.getFacet(facetName);
    assertThat(facet.getIntervalUnit().size(), is(equalTo(3)));

    IntervalUnit unit = facet.getIntervalUnit().get(0);
    assertThat(unit.getKey(), is(dateFormatter.parse("2013-10-18 16:00").getTime()));
    assertThat(unit.getCount(), is(1L));

    unit = facet.getIntervalUnit().get(1);
    assertThat(unit.getKey(), is(dateFormatter.parse("2013-10-18 17:00").getTime()));
    assertThat(unit.getCount(), is(2L));

    unit = facet.getIntervalUnit().get(2);
    assertThat(unit.getKey(), is(dateFormatter.parse("2013-10-18 18:00").getTime()));
    assertThat(unit.getCount(), is(1L));
  }
View Full Code Here

Examples of org.springframework.data.elasticsearch.core.facet.result.HistogramResult

    // when
    FacetedPage<LogEntity> result = elasticsearchTemplate.queryForPage(searchQuery, LogEntity.class);
    // then
    assertThat(result.getNumberOfElements(), is(equalTo(4)));

    HistogramResult facet = (HistogramResult) result.getFacet(facetName);
    assertThat(facet.getIntervalUnit().size(), is(equalTo(3)));

    IntervalUnit unit = facet.getIntervalUnit().get(0);
    assertThat(unit.getKey(), is(SEQUECE_CODE_INSERT));
    assertThat(unit.getCount(), is(1L));

    unit = facet.getIntervalUnit().get(1);
    assertThat(unit.getKey(), is(SEQUECE_CODE_UPDATE));
    assertThat(unit.getCount(), is(2L));

    unit = facet.getIntervalUnit().get(2);
    assertThat(unit.getKey(), is(SEQUECE_CODE_DELETE));
    assertThat(unit.getCount(), is(1L));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.