Package org.elasticsearch.search.facet.statistical

Examples of org.elasticsearch.search.facet.statistical.StatisticalFacetBuilder


            srb = standardSearchRequest(query, IndexHelper.determineAffectedIndices(indexRangeService, deflector, range));
        } else {
            srb = filteredSearchRequest(query, filter, IndexHelper.determineAffectedIndices(indexRangeService, deflector, range));
        }

        StatisticalFacetBuilder stats = new StatisticalFacetBuilder(STATS_FACET_NAME);
        stats.global(false);

        stats.facetFilter(standardFilters(range, filter));

        stats.field(field);

        srb.addFacet(stats);

        SearchResponse r;
        final SearchRequest request;
View Full Code Here


    public static TermsStatsFacetBuilder termsStatsFacet(String facetName) {
        return new TermsStatsFacetBuilder(facetName);
    }

    public static StatisticalFacetBuilder statisticalFacet(String facetName) {
        return new StatisticalFacetBuilder(facetName);
    }
View Full Code Here

  public FacetBuilder getFacet() {
    Assert.notNull(getName(), "Facet name can't be a null !!!");
    Assert.isTrue(StringUtils.isNotBlank(field) && fields == null, "Please select field or fields on which to build the facets !!!");

    StatisticalFacetBuilder builder = FacetBuilders.statisticalFacet(getName());
    if (ArrayUtils.isNotEmpty(fields)) {
      builder.fields(fields);
    } else {
      builder.field(field);
    }

    return builder;
  }
View Full Code Here

     * @throws Exception
     * <br>See <a href="http://www.elasticsearch.org/guide/reference/api/search/facets/statistical-facet.html">documentation</a>
     */
    @Test
    public void statisticalFacet() throws Exception {
        StatisticalFacetBuilder facet = FacetBuilders.statisticalFacet("f")
               .field("price");

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

        f.getCount();           // Doc count
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.facet.statistical.StatisticalFacetBuilder

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.