Package org.springframework.data.elasticsearch.core.facet.request

Examples of org.springframework.data.elasticsearch.core.facet.request.HistogramFacetRequestBuilder


  @Test
  public void shouldReturnSimpleHistogramFacetForGivenQuery() {
    // given
    String facetName = "sequenceCodeFacet";
    SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
        .withFacet(new HistogramFacetRequestBuilder(facetName).field("sequenceCode").interval(1).build()
        ).build();
    // when
    FacetedPage<LogEntity> result = elasticsearchTemplate.queryForPage(searchQuery, LogEntity.class);
    // then
    assertThat(result.getNumberOfElements(), is(equalTo(4)));
View Full Code Here


  @Test
  public void shouldReturnDateHistogramFacetForGivenQuery() throws ParseException {
    // given
    String facetName = "sequenceCodeFacet";
    SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery())
        .withFacet(new HistogramFacetRequestBuilder(facetName).field("date").interval(1).timeUnit(TimeUnit.HOURS).build()
        ).build();
    // when
    FacetedPage<LogEntity> result = elasticsearchTemplate.queryForPage(searchQuery, LogEntity.class);
    // then
    assertThat(result.getNumberOfElements(), is(equalTo(4)));
View Full Code Here

TOP

Related Classes of org.springframework.data.elasticsearch.core.facet.request.HistogramFacetRequestBuilder

Copyright © 2018 www.massapicom. 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.