org.elasticsearch.search.facets.histogram
Class HistogramFacetBuilder

java.lang.Object
  extended by org.elasticsearch.search.facets.AbstractFacetBuilder
      extended by org.elasticsearch.search.facets.histogram.HistogramFacetBuilder
All Implemented Interfaces:
ToXContent

public class HistogramFacetBuilder
extends AbstractFacetBuilder

A facet builder of histogram 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.facets.AbstractFacetBuilder
facetFilter, global, name
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
HistogramFacetBuilder(java.lang.String name)
          Constructs a new histogram facet with the provided facet logical name.
 
Method Summary
 HistogramFacetBuilder comparator(HistogramFacet.ComparatorType comparatorType)
           
 HistogramFacetBuilder facetFilter(XContentFilterBuilder filter)
          An additional filter used to further filter down the set of documents the facet will run on.
 HistogramFacetBuilder field(java.lang.String field)
          The field name to perform the histogram facet.
 HistogramFacetBuilder global(boolean global)
          Should the facet run in global mode (not bounded by the search query) or not (bounded by the search query).
 HistogramFacetBuilder interval(long interval)
          The interval used to control the bucket "size" where each key value of a hit will fall into.
 HistogramFacetBuilder interval(long interval, java.util.concurrent.TimeUnit unit)
          The interval used to control the bucket "size" where each key value of a hit will fall into.
 HistogramFacetBuilder keyField(java.lang.String keyField)
          The field name to use in order to control where the hit will "fall into" within the histogram entries.
 void toXContent(XContentBuilder builder, ToXContent.Params params)
           
 HistogramFacetBuilder valueField(java.lang.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.facets.AbstractFacetBuilder
addFilterFacetAndGlobal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HistogramFacetBuilder

public HistogramFacetBuilder(java.lang.String name)
Constructs a new histogram facet with the provided facet logical name.

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

field

public HistogramFacetBuilder field(java.lang.String field)
The field name to perform the histogram facet. Translates to perform the histogram facet using the provided field as both the keyField(String) and valueField(String).


keyField

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


valueField

public HistogramFacetBuilder valueField(java.lang.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).


interval

public HistogramFacetBuilder interval(long interval)
The interval used to control the bucket "size" where each key value of a hit will fall into.


interval

public HistogramFacetBuilder interval(long interval,
                                      java.util.concurrent.TimeUnit unit)
The interval used to control the bucket "size" where each key value of a hit will fall into.


comparator

public HistogramFacetBuilder comparator(HistogramFacet.ComparatorType comparatorType)

global

public HistogramFacetBuilder 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

facetFilter

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

Overrides:
facetFilter in class AbstractFacetBuilder

toXContent

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