Package org.elasticsearch.search.facet.termsstats

Examples of org.elasticsearch.search.facet.termsstats.TermsStatsFacet$Entry


                    logger.warn("-> {}", shardSearchFailure);
                }
            }
            assertThat(searchResponse.failedShards(), equalTo(0));

            TermsStatsFacet facet = searchResponse.facets().facet("stats1");
            assertThat(facet.entries().size(), equalTo(2));
            assertThat(facet.entries().get(0).term(), equalTo("100"));
            assertThat(facet.entries().get(0).count(), equalTo(2l));
            assertThat(facet.entries().get(0).min(), closeTo(100d, 0.00001d));
            assertThat(facet.entries().get(0).max(), closeTo(200d, 0.00001d));
            assertThat(facet.entries().get(0).total(), closeTo(300d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("200"));
            assertThat(facet.entries().get(1).count(), equalTo(1l));
            assertThat(facet.entries().get(1).min(), closeTo(500d, 0.00001d));
            assertThat(facet.entries().get(1).max(), closeTo(500d, 0.00001d));
            assertThat(facet.entries().get(1).total(), closeTo(500d, 0.00001d));

            facet = searchResponse.facets().facet("stats2");
            assertThat(facet.entries().size(), equalTo(2));
            assertThat(facet.entries().get(0).term(), equalTo("100.1"));
            assertThat(facet.entries().get(0).count(), equalTo(2l));
            assertThat(facet.entries().get(0).min(), closeTo(100d, 0.00001d));
            assertThat(facet.entries().get(0).max(), closeTo(200d, 0.00001d));
            assertThat(facet.entries().get(0).total(), closeTo(300d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("200.2"));
            assertThat(facet.entries().get(1).count(), equalTo(1l));
            assertThat(facet.entries().get(1).min(), closeTo(500d, 0.00001d));
            assertThat(facet.entries().get(1).max(), closeTo(500d, 0.00001d));
            assertThat(facet.entries().get(1).total(), closeTo(500d, 0.00001d));
        }
    }
View Full Code Here


    public void termsStatsFacet() throws Exception {
        TermsStatsFacetBuilder facet = FacetBuilders.termsStatsFacet("f")
                .keyField("brand")
                .valueField("price");

        TermsStatsFacet f = (TermsStatsFacet) launchSearch(facet, "f");

        // For each entry
        for (TermsStatsFacet.Entry entry : f) {
            entry.getTerm();            // Term
            entry.getCount();           // Doc count
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.facet.termsstats.TermsStatsFacet$Entry

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.