org.elasticsearch.search.facet.geodistance
Class GeoDistanceFacetBuilder

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

public class GeoDistanceFacetBuilder
extends AbstractFacetBuilder

A geo distance builder allowing to create a facet of distances from a specific location including the number of hits within each distance range, and aggregated data (like totals of either the distance or cusotm value fields).


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
GeoDistanceFacetBuilder(String name)
          Constructs a new geo distance with the provided facet name.
 
Method Summary
 GeoDistanceFacetBuilder addRange(double from, double to)
          Adds a range entry with explicit from and to.
 GeoDistanceFacetBuilder addUnboundedFrom(double to)
          Adds a range entry with explicit to and unbounded from.
 GeoDistanceFacetBuilder addUnboundedTo(double from)
          Adds a range entry with explicit from and unbounded to.
 GeoDistanceFacetBuilder facetFilter(FilterBuilder filter)
           
 GeoDistanceFacetBuilder field(String fieldName)
          The geo point field that will be used to extract the document location(s).
 GeoDistanceFacetBuilder geoDistance(GeoDistance geoDistance)
          The geo distance type used to compute the distance.
 GeoDistanceFacetBuilder geohash(String geohash)
          The geohash of the geo point to create the range distance facets from.
 GeoDistanceFacetBuilder global(boolean global)
          Marks the facet to run in a global scope, not bounded by any query.
 GeoDistanceFacetBuilder lang(String lang)
          The language of the valueScript(String) script.
 GeoDistanceFacetBuilder lat(double lat)
          The latitude to create the range distance facets from.
 GeoDistanceFacetBuilder lon(double lon)
          The longitude to create the range distance facets from.
 GeoDistanceFacetBuilder nested(String nested)
          Sets the nested path the facet will execute on.
 GeoDistanceFacetBuilder point(double lat, double lon)
          The point to create the range distance facets from.
 GeoDistanceFacetBuilder scope(String scope)
          Marks the facet to run in a specific scope.
 GeoDistanceFacetBuilder scriptParam(String name, Object value)
          Parameters for valueScript(String) to improve performance when executing the same script with different parameters.
 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params)
           
 GeoDistanceFacetBuilder unit(DistanceUnit unit)
          The distance unit to use.
 GeoDistanceFacetBuilder valueField(String valueFieldName)
          A custom value field (numeric) that will be used to provide aggregated data for each facet (for example, total).
 GeoDistanceFacetBuilder valueScript(String valueScript)
          A custom value script (result is numeric) that will be used to provide aggregated data for each facet (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

GeoDistanceFacetBuilder

public GeoDistanceFacetBuilder(String name)
Constructs a new geo distance with the provided facet name.

Method Detail

field

public GeoDistanceFacetBuilder field(String fieldName)
The geo point field that will be used to extract the document location(s).


valueField

public GeoDistanceFacetBuilder valueField(String valueFieldName)
A custom value field (numeric) that will be used to provide aggregated data for each facet (for example, total).


valueScript

public GeoDistanceFacetBuilder valueScript(String valueScript)
A custom value script (result is numeric) that will be used to provide aggregated data for each facet (for example, total).


lang

public GeoDistanceFacetBuilder lang(String lang)
The language of the valueScript(String) script.


scriptParam

public GeoDistanceFacetBuilder scriptParam(String name,
                                           Object value)
Parameters for valueScript(String) to improve performance when executing the same script with different parameters.


point

public GeoDistanceFacetBuilder point(double lat,
                                     double lon)
The point to create the range distance facets from.

Parameters:
lat - latitude.
lon - longitude.

lat

public GeoDistanceFacetBuilder lat(double lat)
The latitude to create the range distance facets from.


lon

public GeoDistanceFacetBuilder lon(double lon)
The longitude to create the range distance facets from.


geohash

public GeoDistanceFacetBuilder geohash(String geohash)
The geohash of the geo point to create the range distance facets from.


geoDistance

public GeoDistanceFacetBuilder geoDistance(GeoDistance geoDistance)
The geo distance type used to compute the distance.


addRange

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

Parameters:
from - The from distance limit
to - The to distance limit

addUnboundedTo

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

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

addUnboundedFrom

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

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

unit

public GeoDistanceFacetBuilder unit(DistanceUnit unit)
The distance unit to use. Defaults to DistanceUnit.KILOMETERS


global

public GeoDistanceFacetBuilder global(boolean global)
Marks the facet to run in a global scope, not bounded by any query.

Overrides:
global in class AbstractFacetBuilder

scope

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

Overrides:
scope in class AbstractFacetBuilder

facetFilter

public GeoDistanceFacetBuilder facetFilter(FilterBuilder filter)
Overrides:
facetFilter in class AbstractFacetBuilder

nested

public GeoDistanceFacetBuilder 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.