org.elasticsearch.index.query
Class FilterBuilders

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

public abstract class FilterBuilders
extends Object

A static factory for simple "import static" usage.


Method Summary
static AndFilterBuilder andFilter(FilterBuilder... filters)
           
static BoolFilterBuilder boolFilter()
           
static ExistsFilterBuilder existsFilter(String name)
          A filter to filter only documents where a field exists in them.
static GeoBoundingBoxFilterBuilder geoBoundingBoxFilter(String name)
          A filter to filter based on a bounding box defined by top left and bottom right locations / points
static GeoDistanceFilterBuilder geoDistanceFilter(String name)
          A filter to filter based on a specific distance from a specific geo location / point.
static GeoDistanceRangeFilterBuilder geoDistanceRangeFilter(String name)
          A filter to filter based on a specific range from a specific geo location / point.
static GeoPolygonFilterBuilder geoPolygonFilter(String name)
          A filter to filter based on a polygon defined by a set of locations / points.
static GeoShapeFilterBuilder geoShapeFilter(String name, com.spatial4j.core.shape.Shape shape)
          A filter to filter based on the relationship between a shape and indexed shapes
static HasChildFilterBuilder hasChildFilter(String type, QueryBuilder query)
          Constructs a child filter, with the child type and the query to run against child documents, with the result of the filter being the *parent* documents.
static IdsFilterBuilder idsFilter(String... types)
          Creates a new ids filter with the provided doc/mapping types.
static IndicesFilterBuilder indicesFilter(FilterBuilder filter, String... indices)
           
static TermsFilterBuilder inFilter(String name, double... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder inFilter(String name, float... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder inFilter(String name, int... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder inFilter(String name, long... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder inFilter(String name, Object... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder inFilter(String name, String... values)
          A filer for a field based on several terms matching on any of them.
static LimitFilterBuilder limitFilter(int limit)
          A filter that limits the results to the provided limit value (per shard!).
static MatchAllFilterBuilder matchAllFilter()
          A filter that matches all documents.
static MissingFilterBuilder missingFilter(String name)
          A filter to filter only documents where a field does not exists in them.
static NestedFilterBuilder nestedFilter(String path, FilterBuilder filter)
           
static NestedFilterBuilder nestedFilter(String path, QueryBuilder query)
           
static NotFilterBuilder notFilter(FilterBuilder filter)
           
static NumericRangeFilterBuilder numericRangeFilter(String name)
          A filter that restricts search results to values that are within the given numeric range.
static OrFilterBuilder orFilter(FilterBuilder... filters)
           
static PrefixFilterBuilder prefixFilter(String name, String prefix)
          A filter that restricts search results to values that have a matching prefix in a given field.
static QueryFilterBuilder queryFilter(QueryBuilder queryBuilder)
          A filter that simply wraps a query.
static RangeFilterBuilder rangeFilter(String name)
          A filter that restricts search results to values that are within the given range.
static ScriptFilterBuilder scriptFilter(String script)
          A builder for filter based on a script.
static TermFilterBuilder termFilter(String name, double value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(String name, float value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(String name, int value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(String name, long value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(String name, Object value)
          A filter for a field based on a term.
static TermFilterBuilder termFilter(String name, String value)
          A filter for a field based on a term.
static TermsFilterBuilder termsFilter(String name, double... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(String name, float... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(String name, int... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(String name, Iterable values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(String name, long... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(String name, Object... values)
          A filer for a field based on several terms matching on any of them.
static TermsFilterBuilder termsFilter(String name, String... values)
          A filer for a field based on several terms matching on any of them.
static TypeFilterBuilder typeFilter(String type)
          A filter based on doc/mapping type.
static WrapperFilterBuilder wrapperFilter(byte[] data, int offset, int length)
           
static WrapperFilterBuilder wrapperFilter(String filter)
           
 
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.


limitFilter

public static LimitFilterBuilder limitFilter(int limit)
A filter that limits the results to the provided limit value (per shard!).


nestedFilter

public static NestedFilterBuilder nestedFilter(String path,
                                               QueryBuilder query)

nestedFilter

public static NestedFilterBuilder nestedFilter(String path,
                                               FilterBuilder filter)

idsFilter

public static IdsFilterBuilder idsFilter(@Nullable
                                         String... types)
Creates a new ids filter with the provided doc/mapping types.

Parameters:
types - The types to match the ids against.

typeFilter

public static TypeFilterBuilder typeFilter(String type)
A filter based on doc/mapping type.


termFilter

public static TermFilterBuilder termFilter(String name,
                                           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(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(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(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(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(String name,
                                           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(String name,
                                             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(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(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(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(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(String name,
                                             Object... 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(String name,
                                             Iterable values)
A filer for a field based on several terms matching on any of them.

Parameters:
name - The field name
values - The terms

inFilter

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

Parameters:
name - The field name
values - The terms

inFilter

public static TermsFilterBuilder inFilter(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

inFilter

public static TermsFilterBuilder inFilter(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

inFilter

public static TermsFilterBuilder inFilter(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

inFilter

public static TermsFilterBuilder inFilter(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

inFilter

public static TermsFilterBuilder inFilter(String name,
                                          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(String name,
                                               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(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(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(QueryBuilder queryBuilder)
A filter that simply wraps a query.

Parameters:
queryBuilder - The query to wrap as a filter

scriptFilter

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

Parameters:
script - The script to filter by.

geoDistanceFilter

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

Parameters:
name - The location field name.

geoDistanceRangeFilter

public static GeoDistanceRangeFilterBuilder geoDistanceRangeFilter(String name)
A filter to filter based on a specific range from a specific geo location / point.

Parameters:
name - The location field name.

geoBoundingBoxFilter

public static GeoBoundingBoxFilterBuilder geoBoundingBoxFilter(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(String name)
A filter to filter based on a polygon defined by a set of locations / points.

Parameters:
name - The location field name.

geoShapeFilter

public static GeoShapeFilterBuilder geoShapeFilter(String name,
                                                   com.spatial4j.core.shape.Shape shape)
A filter to filter based on the relationship between a shape and indexed shapes

Parameters:
name - The shape field name
shape - Shape to use in the filter

existsFilter

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

Parameters:
name - The name of the field

missingFilter

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

Parameters:
name - The name of the field

hasChildFilter

public static HasChildFilterBuilder hasChildFilter(String type,
                                                   QueryBuilder query)
Constructs a child filter, with the child type and the query to run against child documents, with the result of the filter being the *parent* documents.

Parameters:
type - The child type
query - The query to run against the child type

boolFilter

public static BoolFilterBuilder boolFilter()

andFilter

public static AndFilterBuilder andFilter(FilterBuilder... filters)

orFilter

public static OrFilterBuilder orFilter(FilterBuilder... filters)

notFilter

public static NotFilterBuilder notFilter(FilterBuilder filter)

indicesFilter

public static IndicesFilterBuilder indicesFilter(FilterBuilder filter,
                                                 String... indices)

wrapperFilter

public static WrapperFilterBuilder wrapperFilter(String filter)

wrapperFilter

public static WrapperFilterBuilder wrapperFilter(byte[] data,
                                                 int offset,
                                                 int length)


Copyright © 2009-2012. All Rights Reserved.