add test for merging two stats field facet using same facet name
This commit is contained in:
parent
18d8e9dcdd
commit
4f9d9c1395
|
@ -559,6 +559,23 @@ public class SimpleFacetsTests extends AbstractNodesTests {
|
||||||
assertThat(facet.max(), equalTo(4d));
|
assertThat(facet.max(), equalTo(4d));
|
||||||
assertThat(facet.mean(), equalTo(3d));
|
assertThat(facet.mean(), equalTo(3d));
|
||||||
assertThat(facet.sumOfSquares(), equalTo(20d));
|
assertThat(facet.sumOfSquares(), equalTo(20d));
|
||||||
|
|
||||||
|
// test cross field facet using the same facet name...
|
||||||
|
searchResponse = client.prepareSearch()
|
||||||
|
.setQuery(matchAllQuery())
|
||||||
|
.addFacet(statisticalFacet("stats").field("num"))
|
||||||
|
.addFacet(statisticalFacet("stats").field("multi_num"))
|
||||||
|
.execute().actionGet();
|
||||||
|
|
||||||
|
|
||||||
|
facet = searchResponse.facets().facet("stats");
|
||||||
|
assertThat(facet.name(), equalTo(facet.name()));
|
||||||
|
assertThat(facet.count(), equalTo(6l));
|
||||||
|
assertThat(facet.total(), equalTo(13d));
|
||||||
|
assertThat(facet.min(), equalTo(1d));
|
||||||
|
assertThat(facet.max(), equalTo(4d));
|
||||||
|
assertThat(facet.mean(), equalTo(13d / 6d));
|
||||||
|
assertThat(facet.sumOfSquares(), equalTo(35d));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testHistoFacets() throws Exception {
|
@Test public void testHistoFacets() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue