public class RangeQueryBuilder extends AbstractQueryBuilder<RangeQueryBuilder> implements MultiTermQueryBuilder
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_INCLUDE_LOWER |
static boolean |
DEFAULT_INCLUDE_UPPER |
static ParseField |
FROM_FIELD |
static ParseField |
GT_FIELD |
static ParseField |
GTE_FIELD |
static ParseField |
LT_FIELD |
static ParseField |
LTE_FIELD |
static java.lang.String |
NAME |
static ParseField |
TO_FIELD |
boost, BOOST_FIELD, DEFAULT_BOOST, queryName
EMPTY_PARAMS
Constructor and Description |
---|
RangeQueryBuilder(StreamInput in)
Read from a stream.
|
RangeQueryBuilder(java.lang.String fieldName)
A Query that matches documents within an range of terms.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
doEquals(RangeQueryBuilder other)
Indicates whether some other
QueryBuilder object of the same type is "equal to" this one. |
protected int |
doHashCode() |
protected QueryBuilder |
doRewrite(QueryRewriteContext queryRewriteContext) |
protected org.apache.lucene.search.Query |
doToQuery(QueryShardContext context) |
protected void |
doWriteTo(StreamOutput out) |
protected void |
doXContent(XContentBuilder builder,
ToXContent.Params params) |
java.lang.String |
fieldName()
Get the field name for this query.
|
java.lang.String |
format()
Gets the format field to parse the from/to fields
|
RangeQueryBuilder |
format(java.lang.String format)
In case of format field, we can parse the from/to fields using this time format
|
java.lang.Object |
from()
Gets the lower range value for this query.
|
RangeQueryBuilder |
from(java.lang.Object from)
The from part of the range query.
|
RangeQueryBuilder |
from(java.lang.Object from,
boolean includeLower)
The from part of the range query.
|
static java.util.Optional<RangeQueryBuilder> |
fromXContent(QueryParseContext parseContext) |
protected MappedFieldType.Relation |
getRelation(QueryRewriteContext queryRewriteContext) |
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
RangeQueryBuilder |
gt(java.lang.Object from)
The from part of the range query.
|
RangeQueryBuilder |
gte(java.lang.Object from)
The from part of the range query.
|
boolean |
includeLower()
Gets the includeLower flag for this query.
|
RangeQueryBuilder |
includeLower(boolean includeLower)
Should the lower bound be included or not.
|
boolean |
includeUpper()
Gets the includeUpper flag for this query.
|
RangeQueryBuilder |
includeUpper(boolean includeUpper)
Should the upper bound be included or not.
|
RangeQueryBuilder |
lt(java.lang.Object to)
The to part of the range query.
|
RangeQueryBuilder |
lte(java.lang.Object to)
The to part of the range query.
|
ShapeRelation |
relation() |
RangeQueryBuilder |
relation(java.lang.String relation) |
java.lang.String |
timeZone()
In case of date field, gets the from/to fields timezone adjustment
|
RangeQueryBuilder |
timeZone(java.lang.String timeZone)
In case of date field, we can adjust the from/to fields using a timezone
|
java.lang.Object |
to()
Gets the upper range value for this query.
|
RangeQueryBuilder |
to(java.lang.Object to)
The to part of the range query.
|
RangeQueryBuilder |
to(java.lang.Object to,
boolean includeUpper)
The to part of the range query.
|
addValidationError, boost, boost, convertToBytesRefIfString, convertToStringIfBytesRef, declareStandardFields, equals, extractInnerHitBuilders, getName, hashCode, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toFilter, toQueries, toQuery, toXContent, writeQueries, writeTo
buildAsBytes, buildAsBytes, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
boost, boost, getName, queryName, queryName, rewrite, rewriteQuery, toFilter, toQuery
isFragment
toXContent
public static final java.lang.String NAME
public static final boolean DEFAULT_INCLUDE_UPPER
public static final boolean DEFAULT_INCLUDE_LOWER
public static final ParseField LTE_FIELD
public static final ParseField GTE_FIELD
public static final ParseField FROM_FIELD
public static final ParseField TO_FIELD
public static final ParseField GT_FIELD
public static final ParseField LT_FIELD
public RangeQueryBuilder(java.lang.String fieldName)
fieldName
- The field namepublic RangeQueryBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
protected void doWriteTo(StreamOutput out) throws java.io.IOException
doWriteTo
in class AbstractQueryBuilder<RangeQueryBuilder>
java.io.IOException
public java.lang.String fieldName()
public RangeQueryBuilder from(java.lang.Object from, boolean includeLower)
BytesRef
because
in RangeQueryBuilder
field are later parsed as BytesRef
and we need internal representation
of query to be equal regardless of whether it was created from XContent or via Java API.public RangeQueryBuilder from(java.lang.Object from)
public java.lang.Object from()
public RangeQueryBuilder gt(java.lang.Object from)
public RangeQueryBuilder gte(java.lang.Object from)
public RangeQueryBuilder to(java.lang.Object to, boolean includeUpper)
public RangeQueryBuilder to(java.lang.Object to)
public java.lang.Object to()
BytesRef
because
in RangeQueryBuilder
field are later parsed as BytesRef
and we need internal representation
of query to be equal regardless of whether it was created from XContent or via Java API.public RangeQueryBuilder lt(java.lang.Object to)
public RangeQueryBuilder lte(java.lang.Object to)
public RangeQueryBuilder includeLower(boolean includeLower)
public boolean includeLower()
public RangeQueryBuilder includeUpper(boolean includeUpper)
public boolean includeUpper()
public RangeQueryBuilder timeZone(java.lang.String timeZone)
public java.lang.String timeZone()
public RangeQueryBuilder format(java.lang.String format)
public java.lang.String format()
public ShapeRelation relation()
public RangeQueryBuilder relation(java.lang.String relation)
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
doXContent
in class AbstractQueryBuilder<RangeQueryBuilder>
java.io.IOException
public static java.util.Optional<RangeQueryBuilder> fromXContent(QueryParseContext parseContext) throws java.io.IOException
java.io.IOException
public java.lang.String getWriteableName()
NamedWriteable
getWriteableName
in interface NamedWriteable
protected MappedFieldType.Relation getRelation(QueryRewriteContext queryRewriteContext) throws java.io.IOException
java.io.IOException
protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) throws java.io.IOException
doRewrite
in class AbstractQueryBuilder<RangeQueryBuilder>
java.io.IOException
protected org.apache.lucene.search.Query doToQuery(QueryShardContext context) throws java.io.IOException
doToQuery
in class AbstractQueryBuilder<RangeQueryBuilder>
java.io.IOException
protected int doHashCode()
doHashCode
in class AbstractQueryBuilder<RangeQueryBuilder>
protected boolean doEquals(RangeQueryBuilder other)
AbstractQueryBuilder
QueryBuilder
object of the same type is "equal to" this one.doEquals
in class AbstractQueryBuilder<RangeQueryBuilder>