Package org.elasticsearch.index.query
Class RangeQueryBuilder
java.lang.Object
org.elasticsearch.index.query.AbstractQueryBuilder<RangeQueryBuilder>
org.elasticsearch.index.query.RangeQueryBuilder
- All Implemented Interfaces:
NamedWriteable,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject,MultiTermQueryBuilder,QueryBuilder,Rewriteable<QueryBuilder>
public class RangeQueryBuilder
extends AbstractQueryBuilder<RangeQueryBuilder>
implements MultiTermQueryBuilder
A Query that matches documents within an range of terms.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanstatic booleanstatic org.elasticsearch.common.xcontent.ParseFieldstatic org.elasticsearch.common.xcontent.ParseFieldstatic org.elasticsearch.common.xcontent.ParseFieldstatic org.elasticsearch.common.xcontent.ParseFieldstatic org.elasticsearch.common.xcontent.ParseFieldstatic Stringstatic org.elasticsearch.common.xcontent.ParseFieldFields inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryNameFields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDSFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionRangeQueryBuilder(String fieldName)A Query that matches documents within an range of terms.Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandoEquals(RangeQueryBuilder other)Indicates whether some otherQueryBuilderobject of the same type is "equal to" this one.protected intprotected QueryBuilderdoRewrite(QueryRewriteContext queryRewriteContext)protected org.apache.lucene.search.QuerydoToQuery(SearchExecutionContext context)protected voiddoWriteTo(StreamOutput out)protected voiddoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)Get the field name for this query.format()Gets the format field to parse the from/to fieldsIn case of format field, we can parse the from/to fields using this time formatfrom()Gets the lower range value for this query.The from part of the range query.The from part of the range query.static RangeQueryBuilderfromXContent(org.elasticsearch.common.xcontent.XContentParser parser)protected MappedFieldType.RelationgetRelation(QueryRewriteContext queryRewriteContext)Returns the name of the writeable objectThe from part of the range query.The from part of the range query.booleanGets the includeLower flag for this query.includeLower(boolean includeLower)Should the lower bound be included or not.booleanGets the includeUpper flag for this query.includeUpper(boolean includeUpper)Should the upper bound be included or not.The to part of the range query.The to part of the range query.relation()timeZone()In case of date field, gets the from/to fields timezone adjustmentIn case of date field, we can adjust the from/to fields using a timezoneto()Gets the upper range value for this query.The to part of the range query.The to part of the range query.Methods inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, checkNegativeBoost, declareStandardFields, equals, extractInnerHitBuilders, getName, hashCode, parseInnerQueryBuilder, parseInnerQueryBuilder, printBoostAndQueryName, queryName, queryName, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.index.query.QueryBuilder
boost, boost, getName, queryName, queryName, rewrite, toQueryMethods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContentMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
DEFAULT_INCLUDE_UPPER
public static final boolean DEFAULT_INCLUDE_UPPER- See Also:
- Constant Field Values
-
DEFAULT_INCLUDE_LOWER
public static final boolean DEFAULT_INCLUDE_LOWER- See Also:
- Constant Field Values
-
LTE_FIELD
public static final org.elasticsearch.common.xcontent.ParseField LTE_FIELD -
GTE_FIELD
public static final org.elasticsearch.common.xcontent.ParseField GTE_FIELD -
FROM_FIELD
public static final org.elasticsearch.common.xcontent.ParseField FROM_FIELD -
TO_FIELD
public static final org.elasticsearch.common.xcontent.ParseField TO_FIELD -
GT_FIELD
public static final org.elasticsearch.common.xcontent.ParseField GT_FIELD -
LT_FIELD
public static final org.elasticsearch.common.xcontent.ParseField LT_FIELD
-
-
Constructor Details
-
RangeQueryBuilder
A Query that matches documents within an range of terms.- Parameters:
fieldName- The field name
-
RangeQueryBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteToin classAbstractQueryBuilder<RangeQueryBuilder>- Throws:
IOException
-
fieldName
Get the field name for this query.- Specified by:
fieldNamein interfaceMultiTermQueryBuilder
-
from
The from part of the range query. Null indicates unbounded. In case lower bound is assigned to a string, we internally convert it to aBytesRefbecause inRangeQueryBuilderfield are later parsed asBytesRefand we need internal representation of query to be equal regardless of whether it was created from XContent or via Java API. -
from
The from part of the range query. Null indicates unbounded. -
from
Gets the lower range value for this query. -
gt
The from part of the range query. Null indicates unbounded. -
gte
The from part of the range query. Null indicates unbounded. -
to
The to part of the range query. Null indicates unbounded. -
to
The to part of the range query. Null indicates unbounded. -
to
Gets the upper range value for this query. In case upper bound is assigned to a string, we internally convert it to aBytesRefbecause inRangeQueryBuilderfield are later parsed asBytesRefand we need internal representation of query to be equal regardless of whether it was created from XContent or via Java API. -
lt
The to part of the range query. Null indicates unbounded. -
lte
The to part of the range query. Null indicates unbounded. -
includeLower
Should the lower bound be included or not. Defaults totrue. -
includeLower
public boolean includeLower()Gets the includeLower flag for this query. -
includeUpper
Should the upper bound be included or not. Defaults totrue. -
includeUpper
public boolean includeUpper()Gets the includeUpper flag for this query. -
timeZone
In case of date field, we can adjust the from/to fields using a timezone -
timeZone
In case of date field, gets the from/to fields timezone adjustment -
format
In case of format field, we can parse the from/to fields using this time format -
format
Gets the format field to parse the from/to fields -
relation
-
relation
-
doXContent
protected void doXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
doXContentin classAbstractQueryBuilder<RangeQueryBuilder>- Throws:
IOException
-
fromXContent
public static RangeQueryBuilder fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
getWriteableName
Description copied from interface:NamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable
-
getRelation
protected MappedFieldType.Relation getRelation(QueryRewriteContext queryRewriteContext) throws IOException- Throws:
IOException
-
doRewrite
- Overrides:
doRewritein classAbstractQueryBuilder<RangeQueryBuilder>- Throws:
IOException
-
doToQuery
protected org.apache.lucene.search.Query doToQuery(SearchExecutionContext context) throws IOException- Specified by:
doToQueryin classAbstractQueryBuilder<RangeQueryBuilder>- Throws:
IOException
-
doHashCode
protected int doHashCode()- Specified by:
doHashCodein classAbstractQueryBuilder<RangeQueryBuilder>
-
doEquals
Description copied from class:AbstractQueryBuilderIndicates whether some otherQueryBuilderobject of the same type is "equal to" this one.- Specified by:
doEqualsin classAbstractQueryBuilder<RangeQueryBuilder>
-