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

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


    // 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

Related Classes of org.springframework.data.elasticsearch.core.facet.result.HistogramResult

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.