org.elasticsearch.search.facet.range
Class RangeFacetBuilder

java.lang.Object
  extended by org.elasticsearch.search.facet.AbstractFacetBuilder
      extended by org.elasticsearch.search.facet.range.RangeFacetBuilder
All Implemented Interfaces:
ToXContent

public class RangeFacetBuilder
extends AbstractFacetBuilder

A facet builder of range facets.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from class org.elasticsearch.search.facet.AbstractFacetBuilder
facetFilter, name, nested, scope
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
RangeFacetBuilder(String name)
          Constructs a new range facet with the provided facet logical name.
 
Method Summary
 RangeFacetBuilder addRange(double from, double to)
          Adds a range entry with explicit from and to.
 RangeFacetBuilder addRange(String from, String to)
           
 RangeFacetBuilder addUnboundedFrom(double to)
          Adds a range entry with explicit to and unbounded from.
 RangeFacetBuilder addUnboundedFrom(String to)
           
 RangeFacetBuilder addUnboundedTo(double from)
          Adds a range entry with explicit from and unbounded to.
 RangeFacetBuilder addUnboundedTo(String from)
           
 RangeFacetBuilder facetFilter(FilterBuilder filter)
          An additional filter used to further filter down the set of documents the facet will run on.
 RangeFacetBuilder field(String field)
          The field name to perform the range facet.
 RangeFacetBuilder global(boolean global)
          Should the facet run in global mode (not bounded by the search query) or not (bounded by the search query).
 RangeFacetBuilder keyField(String keyField)
          The field name to use in order to control where the hit will "fall into" within the range entries.
 RangeFacetBuilder nested(String nested)
          Sets the nested path the facet will execute on.
 RangeFacetBuilder scope(String scope)
          Marks the facet to run in a specific scope.
 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params)
           
 RangeFacetBuilder valueField(String valueField)
          The field name to use as the value of the hit to compute data based on values within the interval (for example, total).
 
Methods inherited from class org.elasticsearch.search.facet.AbstractFacetBuilder
addFilterFacetAndGlobal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeFacetBuilder

public RangeFacetBuilder(String name)
Constructs a new range facet with the provided facet logical name.

Parameters:
name - The logical name of the facet
Method Detail

field

public RangeFacetBuilder field(String field)
The field name to perform the range facet. Translates to perform the range facet using the provided field as both the keyField(String) and valueField(String).


keyField

public RangeFacetBuilder keyField(String keyField)
The field name to use in order to control where the hit will "fall into" within the range entries. Essentially, using the key field numeric value, the hit will be "rounded" into the relevant bucket controlled by the interval.


valueField

public RangeFacetBuilder valueField(String valueField)
The field name to use as the value of the hit to compute data based on values within the interval (for example, total).


addRange

public RangeFacetBuilder addRange(double from,
                                  double to)
Adds a range entry with explicit from and to.

Parameters:
from - The from range limit
to - The to range limit

addRange

public RangeFacetBuilder addRange(String from,
                                  String to)

addUnboundedTo

public RangeFacetBuilder addUnboundedTo(double from)
Adds a range entry with explicit from and unbounded to.

Parameters:
from - the from range limit, to is unbounded.

addUnboundedTo

public RangeFacetBuilder addUnboundedTo(String from)

addUnboundedFrom

public RangeFacetBuilder addUnboundedFrom(double to)
Adds a range entry with explicit to and unbounded from.

Parameters:
to - the to range limit, from is unbounded.

addUnboundedFrom

public RangeFacetBuilder addUnboundedFrom(String to)

global

public RangeFacetBuilder global(boolean global)
Should the facet run in global mode (not bounded by the search query) or not (bounded by the search query). Defaults to false.

Overrides:
global in class AbstractFacetBuilder

scope

public RangeFacetBuilder scope(String scope)
Marks the facet to run in a specific scope.

Overrides:
scope in class AbstractFacetBuilder

facetFilter

public RangeFacetBuilder facetFilter(FilterBuilder filter)
An additional filter used to further filter down the set of documents the facet will run on.

Overrides:
facetFilter in class AbstractFacetBuilder

nested

public RangeFacetBuilder nested(String nested)
Sets the nested path the facet will execute on. A match (root object) will then cause all the nested objects matching the path to be computed into the facet.

Overrides:
nested in class AbstractFacetBuilder

toXContent

public XContentBuilder toXContent(XContentBuilder builder,
                                  ToXContent.Params params)
                           throws IOException
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.