Package org.elasticsearch.action.search

Examples of org.elasticsearch.action.search.SearchResponse.facets()


        assertThat(searchResponse.failedShards(), equalTo(0));
        assertThat(searchResponse.hits().totalHits(), equalTo(2l));
        assertThat(searchResponse.hits().getAt(0).id(), anyOf(equalTo("p2"), equalTo("p1")));
        assertThat(searchResponse.hits().getAt(1).id(), anyOf(equalTo("p2"), equalTo("p1")));

        assertThat(searchResponse.facets().facets().size(), equalTo(1));
        TermsFacet termsFacet = searchResponse.facets().facet("facet1");
        assertThat(termsFacet.entries().size(), equalTo(2));
        assertThat(termsFacet.entries().get(0).term(), equalTo("red"));
        assertThat(termsFacet.entries().get(0).count(), equalTo(2));
        assertThat(termsFacet.entries().get(1).term(), equalTo("yellow"));
View Full Code Here


        assertThat(searchResponse.hits().totalHits(), equalTo(2l));
        assertThat(searchResponse.hits().getAt(0).id(), anyOf(equalTo("p2"), equalTo("p1")));
        assertThat(searchResponse.hits().getAt(1).id(), anyOf(equalTo("p2"), equalTo("p1")));

        assertThat(searchResponse.facets().facets().size(), equalTo(1));
        TermsFacet termsFacet = searchResponse.facets().facet("facet1");
        assertThat(termsFacet.entries().size(), equalTo(2));
        assertThat(termsFacet.entries().get(0).term(), equalTo("red"));
        assertThat(termsFacet.entries().get(0).count(), equalTo(2));
        assertThat(termsFacet.entries().get(1).term(), equalTo("yellow"));
        assertThat(termsFacet.entries().get(1).count(), equalTo(1));
View Full Code Here

            assertThat(facet.entries().get(0).total(), closeTo(300d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("yyy"));
            assertThat(facet.entries().get(1).count(), equalTo(1l));
            assertThat(facet.entries().get(1).total(), closeTo(500d, 0.00001d));

            facet = searchResponse.facets().facet("stats10");
            assertThat(facet.entries().size(), equalTo(2));
            assertThat(facet.entries().get(0).term(), equalTo("xxx"));
            assertThat(facet.entries().get(0).count(), equalTo(2l));
            assertThat(facet.entries().get(0).total(), closeTo(8d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("yyy"));
View Full Code Here

            assertThat(facet.entries().get(0).total(), closeTo(8d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("yyy"));
            assertThat(facet.entries().get(1).count(), equalTo(1l));
            assertThat(facet.entries().get(1).total(), closeTo(11d, 0.00001d));

            facet = searchResponse.facets().facet("stats11");
            assertThat(facet.entries().size(), equalTo(2));
            assertThat(facet.entries().get(0).term(), equalTo("yyy"));
            assertThat(facet.entries().get(0).count(), equalTo(1l));
            assertThat(facet.entries().get(0).total(), closeTo(500d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("xxx"));
View Full Code Here

            assertThat(facet.entries().get(0).total(), closeTo(500d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("xxx"));
            assertThat(facet.entries().get(1).count(), equalTo(2l));
            assertThat(facet.entries().get(1).total(), closeTo(300d, 0.00001d));

            facet = searchResponse.facets().facet("stats12");
            assertThat(facet.entries().size(), equalTo(2));
            assertThat(facet.entries().get(0).term(), equalTo("yyy"));
            assertThat(facet.entries().get(0).count(), equalTo(1l));
            assertThat(facet.entries().get(0).total(), closeTo(11d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("xxx"));
View Full Code Here

            assertThat(facet.entries().get(0).total(), closeTo(11d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("xxx"));
            assertThat(facet.entries().get(1).count(), equalTo(2l));
            assertThat(facet.entries().get(1).total(), closeTo(8d, 0.00001d));

            facet = searchResponse.facets().facet("stats13");
            assertThat(facet.entries().size(), equalTo(2));
            assertThat(facet.entries().get(0).term(), equalTo("xxx"));
            assertThat(facet.entries().get(0).count(), equalTo(2l));
            assertThat(facet.entries().get(0).total(), closeTo(600d, 0.00001d));
            assertThat(facet.entries().get(1).term(), equalTo("yyy"));
View Full Code Here

                    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));
View Full Code Here

            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));
View Full Code Here

                for (ShardSearchFailure shardSearchFailure : searchResponse.shardFailures()) {
                    logger.warn("-> {}", shardSearchFailure);
                }
            }
            assertThat(searchResponse.failedShards(), equalTo(0));
            TermsStatsFacet facet = searchResponse.facets().facet("stats1");
            assertThat(facet.entries().size(), equalTo(10));

            facet = searchResponse.facets().facet("stats2");
            assertThat(facet.entries().size(), equalTo(10));
        }
View Full Code Here

            }
            assertThat(searchResponse.failedShards(), equalTo(0));
            TermsStatsFacet facet = searchResponse.facets().facet("stats1");
            assertThat(facet.entries().size(), equalTo(10));

            facet = searchResponse.facets().facet("stats2");
            assertThat(facet.entries().size(), equalTo(10));
        }
    }

    @Test public void testQueryFacet() throws Exception {
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.