Package org.elasticsearch.index.query
Class QueryBuilders
- java.lang.Object
-
- org.elasticsearch.index.query.QueryBuilders
-
public final class QueryBuilders extends java.lang.ObjectUtility class to create search queries.
-
-
Method Summary
Modifier and Type Method Description static BoolQueryBuilderboolQuery()A Query that matches documents matching boolean combinations of other queries.static BoostingQueryBuilderboostingQuery(QueryBuilder positiveQuery, QueryBuilder negativeQuery)The BoostingQuery class can be used to effectively demote results that match a given query.static CommonTermsQueryBuildercommonTermsQuery(java.lang.String fieldName, java.lang.Object text)Creates a common query for the provided field name and text.static ConstantScoreQueryBuilderconstantScoreQuery(QueryBuilder queryBuilder)A query that wraps another query and simply returns a constant score equal to the query boost for every document in the query.static DisMaxQueryBuilderdisMaxQuery()A query that generates the union of documents produced by its sub-queries, and that scores each document with the maximum score for that document as produced by any sub-query, plus a tie breaking increment for any additional matching sub-queries.static ExistsQueryBuilderexistsQuery(java.lang.String name)A filter to filter only documents where a field exists in them.static FieldMaskingSpanQueryBuilderfieldMaskingSpanQuery(SpanQueryBuilder query, java.lang.String field)static FunctionScoreQueryBuilderfunctionScoreQuery(FunctionScoreQueryBuilder.FilterFunctionBuilder[] filterFunctionBuilders)A query that allows to define a custom scoring functionstatic FunctionScoreQueryBuilderfunctionScoreQuery(ScoreFunctionBuilder function)A query that allows to define a custom scoring function.static FunctionScoreQueryBuilderfunctionScoreQuery(QueryBuilder queryBuilder)A function_score query with no functions.static FunctionScoreQueryBuilderfunctionScoreQuery(QueryBuilder queryBuilder, FunctionScoreQueryBuilder.FilterFunctionBuilder[] filterFunctionBuilders)A query that allows to define a custom scoring functionstatic FunctionScoreQueryBuilderfunctionScoreQuery(QueryBuilder queryBuilder, ScoreFunctionBuilder function)A query that allows to define a custom scoring function.static FuzzyQueryBuilderfuzzyQuery(java.lang.String name, java.lang.Object value)A Query that matches documents using fuzzy query.static FuzzyQueryBuilderfuzzyQuery(java.lang.String name, java.lang.String value)A Query that matches documents using fuzzy query.static GeoBoundingBoxQueryBuildergeoBoundingBoxQuery(java.lang.String name)A filter to filter based on a bounding box defined by top left and bottom right locations / pointsstatic GeoShapeQueryBuildergeoDisjointQuery(java.lang.String name, java.lang.String indexedShapeId)static GeoShapeQueryBuildergeoDisjointQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)Deprecated.Types are in the process of being removed, usegeoDisjointQuery(String, String)instead.static GeoShapeQueryBuildergeoDisjointQuery(java.lang.String name, ShapeBuilder shape)A filter to filter indexed shapes that are not intersection with the query shapestatic GeoDistanceQueryBuildergeoDistanceQuery(java.lang.String name)A filter to filter based on a specific distance from a specific geo location / point.static GeoShapeQueryBuildergeoIntersectionQuery(java.lang.String name, java.lang.String indexedShapeId)static GeoShapeQueryBuildergeoIntersectionQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)Deprecated.Types are in the process of being removed, usegeoIntersectionQuery(String, String)instead.static GeoShapeQueryBuildergeoIntersectionQuery(java.lang.String name, ShapeBuilder shape)A filter to filter indexed shapes intersecting with shapesstatic GeoPolygonQueryBuildergeoPolygonQuery(java.lang.String name, java.util.List<GeoPoint> points)A filter to filter based on a polygon defined by a set of locations / points.static GeoShapeQueryBuildergeoShapeQuery(java.lang.String name, java.lang.String indexedShapeId)static GeoShapeQueryBuildergeoShapeQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)Deprecated.Types are in the process of being removed, usegeoShapeQuery(String, String)instead.static GeoShapeQueryBuildergeoShapeQuery(java.lang.String name, ShapeBuilder shape)A filter based on the relationship of a shape and indexed shapesstatic GeoShapeQueryBuildergeoWithinQuery(java.lang.String name, java.lang.String indexedShapeId)static GeoShapeQueryBuildergeoWithinQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)Deprecated.Types are in the process of being removed, usegeoWithinQuery(String, String)instead.static GeoShapeQueryBuildergeoWithinQuery(java.lang.String name, ShapeBuilder shape)A filter to filter indexed shapes that are contained by a shapestatic IdsQueryBuilderidsQuery()Constructs a query that will match only specific ids within all types.static IdsQueryBuilderidsQuery(java.lang.String... types)Deprecated.Types are in the process of being removed, useidsQuery()instead.static MatchAllQueryBuildermatchAllQuery()A query that matches on all documents.static MatchPhrasePrefixQueryBuildermatchPhrasePrefixQuery(java.lang.String name, java.lang.Object text)Creates a match query with type "PHRASE_PREFIX" for the provided field name and text.static MatchPhraseQueryBuildermatchPhraseQuery(java.lang.String name, java.lang.Object text)Creates a text query with type "PHRASE" for the provided field name and text.static MatchQueryBuildermatchQuery(java.lang.String name, java.lang.Object text)Creates a match query with type "BOOLEAN" for the provided field name and text.static MoreLikeThisQueryBuildermoreLikeThisQuery(java.lang.String[] likeTexts)A more like this query that finds documents that are "like" the provided texts which is checked against the "_all" field.static MoreLikeThisQueryBuildermoreLikeThisQuery(java.lang.String[] fields, java.lang.String[] likeTexts, MoreLikeThisQueryBuilder.Item[] likeItems)A more like this query that finds documents that are "like" the provided texts or documents which is checked against the fields the query is constructed with.static MoreLikeThisQueryBuildermoreLikeThisQuery(java.lang.String[] likeTexts, MoreLikeThisQueryBuilder.Item[] likeItems)A more like this query that finds documents that are "like" the provided texts or documents which is checked against the "_all" field.static MoreLikeThisQueryBuildermoreLikeThisQuery(MoreLikeThisQueryBuilder.Item[] likeItems)A more like this query that finds documents that are "like" the provided documents which is checked against the "_all" field.static MultiMatchQueryBuildermultiMatchQuery(java.lang.Object text, java.lang.String... fieldNames)Creates a match query with type "BOOLEAN" for the provided field name and text.static NestedQueryBuildernestedQuery(java.lang.String path, QueryBuilder query, org.apache.lucene.search.join.ScoreMode scoreMode)static PrefixQueryBuilderprefixQuery(java.lang.String name, java.lang.String prefix)A Query that matches documents containing terms with a specified prefix.static QueryStringQueryBuilderqueryStringQuery(java.lang.String queryString)A query that parses a query string and runs it.static RangeQueryBuilderrangeQuery(java.lang.String name)A Query that matches documents within an range of terms.static RegexpQueryBuilderregexpQuery(java.lang.String name, java.lang.String regexp)A Query that matches documents containing terms with a specified regular expression.static ScriptQueryBuilderscriptQuery(Script script)A builder for filter based on a script.static ScriptScoreQueryBuilderscriptScoreQuery(QueryBuilder queryBuilder, ScriptScoreFunctionBuilder function)A query that allows to define a custom scoring function through script.static SimpleQueryStringBuildersimpleQueryStringQuery(java.lang.String queryString)A query that acts similar to a query_string query, but won't throw exceptions for any weird string syntax.static SpanContainingQueryBuilderspanContainingQuery(SpanQueryBuilder big, SpanQueryBuilder little)Creates a newspan_containingbuilder.static SpanFirstQueryBuilderspanFirstQuery(SpanQueryBuilder match, int end)static SpanMultiTermQueryBuilderspanMultiTermQueryBuilder(MultiTermQueryBuilder multiTermQueryBuilder)Creates aSpanQueryBuilderwhich allows having a sub query which implementsMultiTermQueryBuilder.static SpanNearQueryBuilderspanNearQuery(SpanQueryBuilder initialClause, int slop)static SpanNotQueryBuilderspanNotQuery(SpanQueryBuilder include, SpanQueryBuilder exclude)static SpanOrQueryBuilderspanOrQuery(SpanQueryBuilder initialClause)static SpanTermQueryBuilderspanTermQuery(java.lang.String name, double value)static SpanTermQueryBuilderspanTermQuery(java.lang.String name, float value)static SpanTermQueryBuilderspanTermQuery(java.lang.String name, int value)static SpanTermQueryBuilderspanTermQuery(java.lang.String name, long value)static SpanTermQueryBuilderspanTermQuery(java.lang.String name, java.lang.String value)static SpanWithinQueryBuilderspanWithinQuery(SpanQueryBuilder big, SpanQueryBuilder little)Creates a newspan_withinbuilder.static TermQueryBuildertermQuery(java.lang.String name, boolean value)A Query that matches documents containing a term.static TermQueryBuildertermQuery(java.lang.String name, double value)A Query that matches documents containing a term.static TermQueryBuildertermQuery(java.lang.String name, float value)A Query that matches documents containing a term.static TermQueryBuildertermQuery(java.lang.String name, int value)A Query that matches documents containing a term.static TermQueryBuildertermQuery(java.lang.String name, long value)A Query that matches documents containing a term.static TermQueryBuildertermQuery(java.lang.String name, java.lang.Object value)A Query that matches documents containing a term.static TermQueryBuildertermQuery(java.lang.String name, java.lang.String value)A Query that matches documents containing a term.static TermsQueryBuildertermsLookupQuery(java.lang.String name, TermsLookup termsLookup)A terms query that can extract the terms from another doc in an index.static TermsQueryBuildertermsQuery(java.lang.String name, double... values)A filer for a field based on several terms matching on any of them.static TermsQueryBuildertermsQuery(java.lang.String name, float... values)A filer for a field based on several terms matching on any of them.static TermsQueryBuildertermsQuery(java.lang.String name, int... values)A filer for a field based on several terms matching on any of them.static TermsQueryBuildertermsQuery(java.lang.String name, long... values)A filer for a field based on several terms matching on any of them.static TermsQueryBuildertermsQuery(java.lang.String name, java.lang.Object... values)A filer for a field based on several terms matching on any of them.static TermsQueryBuildertermsQuery(java.lang.String name, java.lang.String... values)A filer for a field based on several terms matching on any of them.static TermsQueryBuildertermsQuery(java.lang.String name, java.util.Collection<?> values)A filer for a field based on several terms matching on any of them.static TypeQueryBuildertypeQuery(java.lang.String type)Deprecated.Types are going away, prefer filtering on a field.static WildcardQueryBuilderwildcardQuery(java.lang.String name, java.lang.String query)Implements the wildcard search query.static WrapperQueryBuilderwrapperQuery(byte[] source)A Query builder which allows building a query thanks to a JSON string or binary data.static WrapperQueryBuilderwrapperQuery(java.lang.String source)A Query builder which allows building a query thanks to a JSON string or binary data.static WrapperQueryBuilderwrapperQuery(BytesReference source)A Query builder which allows building a query thanks to a JSON string or binary data.
-
-
-
Method Detail
-
matchAllQuery
public static MatchAllQueryBuilder matchAllQuery()
A query that matches on all documents.
-
matchQuery
public static MatchQueryBuilder matchQuery(java.lang.String name, java.lang.Object text)
Creates a match query with type "BOOLEAN" for the provided field name and text.- Parameters:
name- The field name.text- The query text (to be analyzed).
-
commonTermsQuery
public static CommonTermsQueryBuilder commonTermsQuery(java.lang.String fieldName, java.lang.Object text)
Creates a common query for the provided field name and text.- Parameters:
fieldName- The field name.text- The query text (to be analyzed).
-
multiMatchQuery
public static MultiMatchQueryBuilder multiMatchQuery(java.lang.Object text, java.lang.String... fieldNames)
Creates a match query with type "BOOLEAN" for the provided field name and text.- Parameters:
fieldNames- The field names.text- The query text (to be analyzed).
-
matchPhraseQuery
public static MatchPhraseQueryBuilder matchPhraseQuery(java.lang.String name, java.lang.Object text)
Creates a text query with type "PHRASE" for the provided field name and text.- Parameters:
name- The field name.text- The query text (to be analyzed).
-
matchPhrasePrefixQuery
public static MatchPhrasePrefixQueryBuilder matchPhrasePrefixQuery(java.lang.String name, java.lang.Object text)
Creates a match query with type "PHRASE_PREFIX" for the provided field name and text.- Parameters:
name- The field name.text- The query text (to be analyzed).
-
disMaxQuery
public static DisMaxQueryBuilder disMaxQuery()
A query that generates the union of documents produced by its sub-queries, and that scores each document with the maximum score for that document as produced by any sub-query, plus a tie breaking increment for any additional matching sub-queries.
-
idsQuery
public static IdsQueryBuilder idsQuery()
Constructs a query that will match only specific ids within all types.
-
idsQuery
@Deprecated public static IdsQueryBuilder idsQuery(java.lang.String... types)
Deprecated.Types are in the process of being removed, useidsQuery()instead.Constructs a query that will match only specific ids within types.- Parameters:
types- The mapping/doc type
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, java.lang.String value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, int value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, long value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, float value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, double value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, boolean value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
termQuery
public static TermQueryBuilder termQuery(java.lang.String name, java.lang.Object value)
A Query that matches documents containing a term.- Parameters:
name- The name of the fieldvalue- The value of the term
-
fuzzyQuery
public static FuzzyQueryBuilder fuzzyQuery(java.lang.String name, java.lang.String value)
A Query that matches documents using fuzzy query.- Parameters:
name- The name of the fieldvalue- The value of the term- See Also:
matchQuery(String, Object),rangeQuery(String)
-
fuzzyQuery
public static FuzzyQueryBuilder fuzzyQuery(java.lang.String name, java.lang.Object value)
A Query that matches documents using fuzzy query.- Parameters:
name- The name of the fieldvalue- The value of the term- See Also:
matchQuery(String, Object),rangeQuery(String)
-
prefixQuery
public static PrefixQueryBuilder prefixQuery(java.lang.String name, java.lang.String prefix)
A Query that matches documents containing terms with a specified prefix.- Parameters:
name- The name of the fieldprefix- The prefix query
-
rangeQuery
public static RangeQueryBuilder rangeQuery(java.lang.String name)
A Query that matches documents within an range of terms.- Parameters:
name- The field name
-
wildcardQuery
public static WildcardQueryBuilder wildcardQuery(java.lang.String name, java.lang.String query)
Implements the wildcard search query. Supported wildcards are*, which matches any character sequence (including the empty one), and?, which matches any single character. Note this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, a Wildcard term should not start with one of the wildcards*or?.- Parameters:
name- The field namequery- The wildcard query string
-
regexpQuery
public static RegexpQueryBuilder regexpQuery(java.lang.String name, java.lang.String regexp)
A Query that matches documents containing terms with a specified regular expression.- Parameters:
name- The name of the fieldregexp- The regular expression
-
queryStringQuery
public static QueryStringQueryBuilder queryStringQuery(java.lang.String queryString)
A query that parses a query string and runs it. There are two modes that this operates. The first, when no field is added (usingQueryStringQueryBuilder.field(String), will run the query once and non prefixed fields will use theQueryStringQueryBuilder.defaultField(String)set. The second, when one or more fields are added (usingQueryStringQueryBuilder.field(String)), will run the parsed query against the provided fields, and combine them either using Dismax.- Parameters:
queryString- The query string to run
-
simpleQueryStringQuery
public static SimpleQueryStringBuilder simpleQueryStringQuery(java.lang.String queryString)
A query that acts similar to a query_string query, but won't throw exceptions for any weird string syntax. SeeSimpleQueryParserfor the full supported syntax.
-
boostingQuery
public static BoostingQueryBuilder boostingQuery(QueryBuilder positiveQuery, QueryBuilder negativeQuery)
The BoostingQuery class can be used to effectively demote results that match a given query. Unlike the "NOT" clause, this still selects documents that contain undesirable terms, but reduces their overall score:
-
boolQuery
public static BoolQueryBuilder boolQuery()
A Query that matches documents matching boolean combinations of other queries.
-
spanTermQuery
public static SpanTermQueryBuilder spanTermQuery(java.lang.String name, java.lang.String value)
-
spanTermQuery
public static SpanTermQueryBuilder spanTermQuery(java.lang.String name, int value)
-
spanTermQuery
public static SpanTermQueryBuilder spanTermQuery(java.lang.String name, long value)
-
spanTermQuery
public static SpanTermQueryBuilder spanTermQuery(java.lang.String name, float value)
-
spanTermQuery
public static SpanTermQueryBuilder spanTermQuery(java.lang.String name, double value)
-
spanFirstQuery
public static SpanFirstQueryBuilder spanFirstQuery(SpanQueryBuilder match, int end)
-
spanNearQuery
public static SpanNearQueryBuilder spanNearQuery(SpanQueryBuilder initialClause, int slop)
-
spanNotQuery
public static SpanNotQueryBuilder spanNotQuery(SpanQueryBuilder include, SpanQueryBuilder exclude)
-
spanOrQuery
public static SpanOrQueryBuilder spanOrQuery(SpanQueryBuilder initialClause)
-
spanWithinQuery
public static SpanWithinQueryBuilder spanWithinQuery(SpanQueryBuilder big, SpanQueryBuilder little)
Creates a newspan_withinbuilder.- Parameters:
big- the big clause, it must encloselittlefor a match.little- the little clause, it must be contained withinbigfor a match.
-
spanContainingQuery
public static SpanContainingQueryBuilder spanContainingQuery(SpanQueryBuilder big, SpanQueryBuilder little)
Creates a newspan_containingbuilder.- Parameters:
big- the big clause, it must encloselittlefor a match.little- the little clause, it must be contained withinbigfor a match.
-
spanMultiTermQueryBuilder
public static SpanMultiTermQueryBuilder spanMultiTermQueryBuilder(MultiTermQueryBuilder multiTermQueryBuilder)
Creates aSpanQueryBuilderwhich allows having a sub query which implementsMultiTermQueryBuilder. This is useful for having e.g. wildcard or fuzzy queries inside spans.- Parameters:
multiTermQueryBuilder- TheMultiTermQueryBuilderthat backs the created builder.
-
fieldMaskingSpanQuery
public static FieldMaskingSpanQueryBuilder fieldMaskingSpanQuery(SpanQueryBuilder query, java.lang.String field)
-
constantScoreQuery
public static ConstantScoreQueryBuilder constantScoreQuery(QueryBuilder queryBuilder)
A query that wraps another query and simply returns a constant score equal to the query boost for every document in the query.- Parameters:
queryBuilder- The query to wrap in a constant score query
-
functionScoreQuery
public static FunctionScoreQueryBuilder functionScoreQuery(QueryBuilder queryBuilder)
A function_score query with no functions.- Parameters:
queryBuilder- The query to custom score- Returns:
- the function score query
-
functionScoreQuery
public static FunctionScoreQueryBuilder functionScoreQuery(QueryBuilder queryBuilder, FunctionScoreQueryBuilder.FilterFunctionBuilder[] filterFunctionBuilders)
A query that allows to define a custom scoring function- Parameters:
queryBuilder- The query to custom scorefilterFunctionBuilders- the filters and functions to execute- Returns:
- the function score query
-
functionScoreQuery
public static FunctionScoreQueryBuilder functionScoreQuery(FunctionScoreQueryBuilder.FilterFunctionBuilder[] filterFunctionBuilders)
A query that allows to define a custom scoring function- Parameters:
filterFunctionBuilders- the filters and functions to execute- Returns:
- the function score query
-
functionScoreQuery
public static FunctionScoreQueryBuilder functionScoreQuery(ScoreFunctionBuilder function)
A query that allows to define a custom scoring function.- Parameters:
function- The function builder used to custom score
-
functionScoreQuery
public static FunctionScoreQueryBuilder functionScoreQuery(QueryBuilder queryBuilder, ScoreFunctionBuilder function)
A query that allows to define a custom scoring function.- Parameters:
queryBuilder- The query to custom scorefunction- The function builder used to custom score
-
scriptScoreQuery
public static ScriptScoreQueryBuilder scriptScoreQuery(QueryBuilder queryBuilder, ScriptScoreFunctionBuilder function)
A query that allows to define a custom scoring function through script.- Parameters:
queryBuilder- The query to custom scorefunction- The script score function builder used to custom score
-
moreLikeThisQuery
public static MoreLikeThisQueryBuilder moreLikeThisQuery(java.lang.String[] fields, java.lang.String[] likeTexts, MoreLikeThisQueryBuilder.Item[] likeItems)
A more like this query that finds documents that are "like" the provided texts or documents which is checked against the fields the query is constructed with.- Parameters:
fields- the field names that will be used when generating the 'More Like This' query.likeTexts- the text to use when generating the 'More Like This' query.likeItems- the documents to use when generating the 'More Like This' query.
-
moreLikeThisQuery
public static MoreLikeThisQueryBuilder moreLikeThisQuery(java.lang.String[] likeTexts, MoreLikeThisQueryBuilder.Item[] likeItems)
A more like this query that finds documents that are "like" the provided texts or documents which is checked against the "_all" field.- Parameters:
likeTexts- the text to use when generating the 'More Like This' query.likeItems- the documents to use when generating the 'More Like This' query.
-
moreLikeThisQuery
public static MoreLikeThisQueryBuilder moreLikeThisQuery(java.lang.String[] likeTexts)
A more like this query that finds documents that are "like" the provided texts which is checked against the "_all" field.- Parameters:
likeTexts- the text to use when generating the 'More Like This' query.
-
moreLikeThisQuery
public static MoreLikeThisQueryBuilder moreLikeThisQuery(MoreLikeThisQueryBuilder.Item[] likeItems)
A more like this query that finds documents that are "like" the provided documents which is checked against the "_all" field.- Parameters:
likeItems- the documents to use when generating the 'More Like This' query.
-
nestedQuery
public static NestedQueryBuilder nestedQuery(java.lang.String path, QueryBuilder query, org.apache.lucene.search.join.ScoreMode scoreMode)
-
termsQuery
public static TermsQueryBuilder termsQuery(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 namevalues- The terms
-
termsQuery
public static TermsQueryBuilder termsQuery(java.lang.String name, int... values)
A filer for a field based on several terms matching on any of them.- Parameters:
name- The field namevalues- The terms
-
termsQuery
public static TermsQueryBuilder termsQuery(java.lang.String name, long... values)
A filer for a field based on several terms matching on any of them.- Parameters:
name- The field namevalues- The terms
-
termsQuery
public static TermsQueryBuilder termsQuery(java.lang.String name, float... values)
A filer for a field based on several terms matching on any of them.- Parameters:
name- The field namevalues- The terms
-
termsQuery
public static TermsQueryBuilder termsQuery(java.lang.String name, double... values)
A filer for a field based on several terms matching on any of them.- Parameters:
name- The field namevalues- The terms
-
termsQuery
public static TermsQueryBuilder termsQuery(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 namevalues- The terms
-
termsQuery
public static TermsQueryBuilder termsQuery(java.lang.String name, java.util.Collection<?> values)
A filer for a field based on several terms matching on any of them.- Parameters:
name- The field namevalues- The terms
-
wrapperQuery
public static WrapperQueryBuilder wrapperQuery(java.lang.String source)
A Query builder which allows building a query thanks to a JSON string or binary data.
-
wrapperQuery
public static WrapperQueryBuilder wrapperQuery(BytesReference source)
A Query builder which allows building a query thanks to a JSON string or binary data.
-
wrapperQuery
public static WrapperQueryBuilder wrapperQuery(byte[] source)
A Query builder which allows building a query thanks to a JSON string or binary data.
-
typeQuery
@Deprecated public static TypeQueryBuilder typeQuery(java.lang.String type)
Deprecated.Types are going away, prefer filtering on a field.A filter based on doc/mapping type.
-
termsLookupQuery
public static TermsQueryBuilder termsLookupQuery(java.lang.String name, TermsLookup termsLookup)
A terms query that can extract the terms from another doc in an index.
-
scriptQuery
public static ScriptQueryBuilder scriptQuery(Script script)
A builder for filter based on a script.- Parameters:
script- The script to filter by.
-
geoDistanceQuery
public static GeoDistanceQueryBuilder geoDistanceQuery(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.
-
geoBoundingBoxQuery
public static GeoBoundingBoxQueryBuilder geoBoundingBoxQuery(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.
-
geoPolygonQuery
public static GeoPolygonQueryBuilder geoPolygonQuery(java.lang.String name, java.util.List<GeoPoint> points)
A filter to filter based on a polygon defined by a set of locations / points.- Parameters:
name- The location field name.
-
geoShapeQuery
public static GeoShapeQueryBuilder geoShapeQuery(java.lang.String name, ShapeBuilder shape) throws java.io.IOException
A filter based on the relationship of a shape and indexed shapes- Parameters:
name- The shape field nameshape- Shape to use in the filter- Throws:
java.io.IOException
-
geoShapeQuery
public static GeoShapeQueryBuilder geoShapeQuery(java.lang.String name, java.lang.String indexedShapeId)
-
geoShapeQuery
@Deprecated public static GeoShapeQueryBuilder geoShapeQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)
Deprecated.Types are in the process of being removed, usegeoShapeQuery(String, String)instead.
-
geoIntersectionQuery
public static GeoShapeQueryBuilder geoIntersectionQuery(java.lang.String name, ShapeBuilder shape) throws java.io.IOException
A filter to filter indexed shapes intersecting with shapes- Parameters:
name- The shape field nameshape- Shape to use in the filter- Throws:
java.io.IOException
-
geoIntersectionQuery
public static GeoShapeQueryBuilder geoIntersectionQuery(java.lang.String name, java.lang.String indexedShapeId)
-
geoIntersectionQuery
@Deprecated public static GeoShapeQueryBuilder geoIntersectionQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)
Deprecated.Types are in the process of being removed, usegeoIntersectionQuery(String, String)instead.
-
geoWithinQuery
public static GeoShapeQueryBuilder geoWithinQuery(java.lang.String name, ShapeBuilder shape) throws java.io.IOException
A filter to filter indexed shapes that are contained by a shape- Parameters:
name- The shape field nameshape- Shape to use in the filter- Throws:
java.io.IOException
-
geoWithinQuery
public static GeoShapeQueryBuilder geoWithinQuery(java.lang.String name, java.lang.String indexedShapeId)
-
geoWithinQuery
@Deprecated public static GeoShapeQueryBuilder geoWithinQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)
Deprecated.Types are in the process of being removed, usegeoWithinQuery(String, String)instead.
-
geoDisjointQuery
public static GeoShapeQueryBuilder geoDisjointQuery(java.lang.String name, ShapeBuilder shape) throws java.io.IOException
A filter to filter indexed shapes that are not intersection with the query shape- Parameters:
name- The shape field nameshape- Shape to use in the filter- Throws:
java.io.IOException
-
geoDisjointQuery
public static GeoShapeQueryBuilder geoDisjointQuery(java.lang.String name, java.lang.String indexedShapeId)
-
geoDisjointQuery
@Deprecated public static GeoShapeQueryBuilder geoDisjointQuery(java.lang.String name, java.lang.String indexedShapeId, java.lang.String indexedShapeType)
Deprecated.Types are in the process of being removed, usegeoDisjointQuery(String, String)instead.
-
existsQuery
public static ExistsQueryBuilder existsQuery(java.lang.String name)
A filter to filter only documents where a field exists in them.- Parameters:
name- The name of the field
-
-