org.elasticsearch.index.query.xcontent
Class FilterBuilders

java.lang.Object
  extended by org.elasticsearch.index.query.xcontent.FilterBuilders

public abstract class FilterBuilders
extends java.lang.Object

A static factory for simple "import static" usage.


Method Summary
static AndFilterBuilder andFilter(XContentFilterBuilder... filters)
           
static BoolFilterBuilder boolFilter()
           
static ExistsFilterBuilder exists(java.lang.String name)
          A filter to filter only documents where a field exists in them.
static GeoBoundingBoxFilterBuilder geoBoundingBoxFilter(java.lang.String name)
          A filter to filter based on a bounding box defined by top left and bottom right locations / points
static GeoDistanceFilterBuilder geoDistanceFilter(java.lang.String name)
          A filter to filter based on a specific distance from a specific geo location / point.
static GeoPolygonFilterBuilder geoPolygonFilter(java.lang.String name)
          A filter to filter based on a polygon defined by a set of locations / points.
static MatchAllFilterBuilder matchAllFilter()
          A filter that matches all documents.
static MissingFilterBuilder missing(java.lang.String name)
          A filter to filter only documents where a field does not exists in them.
static NotFilterBuilder notFilter(XContentFilterBuilder filter)
           
static NumericRangeFilterBuilder numericRangeFilter(java.lang.String name)
          A filter that restricts search results to values that are within the given numeric range.
static OrFilterBuilder orFilter(XContentFilterBuilder... filters)
           
static PrefixFilterBuilder prefixFilter(java.lang.String name, java.lang.String prefix)
          A filter that restricts search results to values that have a matching prefix in a given field.
static QueryFilterBuilder queryFilter(XContentQueryBuilder queryBuilder)
          A filter that simply wraps a query.
static RangeFilterBuilder rangeFilter(java.lang.String name)
          A filter that restricts search results to values that are within the given range.
static ScriptFilterBuilder scriptFilter(java.lang.String script)
          A builder for filter based on a script.
static TermFilterBuilder termFilter(java.lang.String name, double value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(java.lang.String name, float value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(java.lang.String name, int value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(java.lang.String name, long value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(java.lang.String name, java.lang.Object value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(java.lang.String name, java.lang.String value)
          A filter for a field based on a term.
static TermsFilterBuilder termsFilter(java.lang.String name, double... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(java.lang.String name, float... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(java.lang.String name, int... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(java.lang.String name, long... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(java.lang.String name, java.lang.Object... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(java.lang.String name, java.lang.String... values)
          A filer for a field based on several terms matching on any of them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

matchAllFilter

public static MatchAllFilterBuilder matchAllFilter()
A filter that matches all documents.


termFilter

public static TermFilterBuilder termFilter(java.lang.String name,
                                           java.lang.String value)
A filter for a field based on a term.

Parameters:
name - The field name
value - The term value

termFilter

public static TermFilterBuilder termFilter(java.lang.String name,
                                           int value)
A filter for a field based on a term.

Parameters:
name - The field name
value - The term value

termFilter

public static TermFilterBuilder termFilter(java.lang.String name,
                                           long value)
A filter for a field based on a term.

Parameters:
name - The field name
value - The term value

termFilter

public static TermFilterBuilder termFilter(java.lang.String name,
                                           float value)
A filter for a field based on a term.

Parameters:
name - The field name
value - The term value

termFilter

public static TermFilterBuilder termFilter(java.lang.String name,
                                           double value)
A filter for a field based on a term.

Parameters:
name - The field name
value - The term value

termFilter

public static TermFilterBuilder termFilter(java.lang.String name,
                                           java.lang.Object value)
A filter for a field based on a term.

Parameters:
name - The field name
value - The term value

termsFilter

public static TermsFilterBuilder termsFilter(java.lang.String name,
                                             java.lang.String... values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

termsFilter

public static TermsFilterBuilder termsFilter(java.lang.String name,
                                             int... values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

termsFilter

public static TermsFilterBuilder termsFilter(java.lang.String name,
                                             long... values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

termsFilter

public static TermsFilterBuilder termsFilter(java.lang.String name,
                                             float... values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

termsFilter

public static TermsFilterBuilder termsFilter(java.lang.String name,
                                             double... values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

termsFilter

public static TermsFilterBuilder termsFilter(java.lang.String name,
                                             java.lang.Object... values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

prefixFilter

public static PrefixFilterBuilder prefixFilter(java.lang.String name,
                                               java.lang.String prefix)
A filter that restricts search results to values that have a matching prefix in a given field.

Parameters:
name - The field name
prefix - The prefix

rangeFilter

public static RangeFilterBuilder rangeFilter(java.lang.String name)
A filter that restricts search results to values that are within the given range.

Parameters:
name - The field name

numericRangeFilter

public static NumericRangeFilterBuilder numericRangeFilter(java.lang.String name)
A filter that restricts search results to values that are within the given numeric range. Uses the field data cache (loading all the values for the specified field into memory)

Parameters:
name - The field name

queryFilter

public static QueryFilterBuilder queryFilter(XContentQueryBuilder queryBuilder)
A filter that simply wraps a query.

Parameters:
queryBuilder - The query to wrap as a filter

scriptFilter

public static ScriptFilterBuilder scriptFilter(java.lang.String script)
A builder for filter based on a script.

Parameters:
script - The script to filter by.

geoDistanceFilter

public static GeoDistanceFilterBuilder geoDistanceFilter(java.lang.String name)
A filter to filter based on a specific distance from a specific geo location / point.

Parameters:
name - The location field name.

geoBoundingBoxFilter

public static GeoBoundingBoxFilterBuilder geoBoundingBoxFilter(java.lang.String name)
A filter to filter based on a bounding box defined by top left and bottom right locations / points

Parameters:
name - The location field name.

geoPolygonFilter

public static GeoPolygonFilterBuilder geoPolygonFilter(java.lang.String name)
A filter to filter based on a polygon defined by a set of locations / points.

Parameters:
name - The location field name.

exists

public static ExistsFilterBuilder exists(java.lang.String name)
A filter to filter only documents where a field exists in them.

Parameters:
name - The name of the field

missing

public static MissingFilterBuilder missing(java.lang.String name)
A filter to filter only documents where a field does not exists in them.

Parameters:
name - The name of the field

boolFilter

public static BoolFilterBuilder boolFilter()

andFilter

public static AndFilterBuilder andFilter(XContentFilterBuilder... filters)

orFilter

public static OrFilterBuilder orFilter(XContentFilterBuilder... filters)

notFilter

public static NotFilterBuilder notFilter(XContentFilterBuilder filter)