public class GeoShapeQueryBuilder extends AbstractQueryBuilder<GeoShapeQueryBuilder>
QueryBuilder
that builds a GeoShape QueryWriteable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_IGNORE_UNMAPPED
The default value for ignore_unmapped.
|
static java.lang.String |
DEFAULT_SHAPE_FIELD_NAME |
static java.lang.String |
DEFAULT_SHAPE_INDEX_NAME |
static ShapeRelation |
DEFAULT_SHAPE_RELATION |
static java.lang.String |
NAME |
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName
EMPTY_PARAMS
Constructor and Description |
---|
GeoShapeQueryBuilder(StreamInput in)
Read from a stream.
|
GeoShapeQueryBuilder(java.lang.String fieldName,
ShapeBuilder shape)
Creates a new GeoShapeQueryBuilder whose Query will be against the given
field name using the given Shape
|
GeoShapeQueryBuilder(java.lang.String fieldName,
java.lang.String indexedShapeId,
java.lang.String indexedShapeType)
Creates a new GeoShapeQueryBuilder whose Query will be against the given
field name and will use the Shape found with the given ID in the given
type
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
doEquals(GeoShapeQueryBuilder other)
Indicates whether some other
QueryBuilder object of the same type is "equal to" this one. |
protected int |
doHashCode() |
protected QueryBuilder |
doRewrite(QueryRewriteContext queryShardContext) |
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() |
static java.util.Optional<GeoShapeQueryBuilder> |
fromXContent(QueryParseContext parseContext) |
static org.apache.lucene.spatial.query.SpatialArgs |
getArgs(ShapeBuilder shape,
ShapeRelation relation) |
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
boolean |
ignoreUnmapped()
Gets whether the query builder will ignore unmapped fields (and run a
MatchNoDocsQuery in place of this query) or throw an exception if
the field is unmapped. |
GeoShapeQueryBuilder |
ignoreUnmapped(boolean ignoreUnmapped)
Sets whether the query builder should ignore unmapped fields (and run a
MatchNoDocsQuery in place of this query) or throw an exception if
the field is unmapped. |
java.lang.String |
indexedShapeId() |
java.lang.String |
indexedShapeIndex() |
GeoShapeQueryBuilder |
indexedShapeIndex(java.lang.String indexedShapeIndex)
Sets the name of the index where the indexed Shape can be found
|
java.lang.String |
indexedShapePath() |
GeoShapeQueryBuilder |
indexedShapePath(java.lang.String indexedShapePath)
Sets the path of the field in the indexed Shape document that has the Shape itself
|
java.lang.String |
indexedShapeType() |
ShapeRelation |
relation() |
GeoShapeQueryBuilder |
relation(ShapeRelation relation)
Sets the relation of query shape and indexed shape.
|
ShapeBuilder |
shape() |
SpatialStrategy |
strategy() |
GeoShapeQueryBuilder |
strategy(SpatialStrategy strategy)
Defines which spatial strategy will be used for building the geo shape
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
rewriteQuery
public static final java.lang.String NAME
public static final java.lang.String DEFAULT_SHAPE_INDEX_NAME
public static final java.lang.String DEFAULT_SHAPE_FIELD_NAME
public static final ShapeRelation DEFAULT_SHAPE_RELATION
public static final boolean DEFAULT_IGNORE_UNMAPPED
public GeoShapeQueryBuilder(java.lang.String fieldName, ShapeBuilder shape)
fieldName
- Name of the field that will be queriedshape
- Shape used in the Querypublic GeoShapeQueryBuilder(java.lang.String fieldName, java.lang.String indexedShapeId, java.lang.String indexedShapeType)
fieldName
- Name of the field that will be filteredindexedShapeId
- ID of the indexed Shape that will be used in the QueryindexedShapeType
- Index type of the indexed Shapespublic GeoShapeQueryBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
protected void doWriteTo(StreamOutput out) throws java.io.IOException
doWriteTo
in class AbstractQueryBuilder<GeoShapeQueryBuilder>
java.io.IOException
public java.lang.String fieldName()
public ShapeBuilder shape()
public java.lang.String indexedShapeId()
public java.lang.String indexedShapeType()
public GeoShapeQueryBuilder strategy(SpatialStrategy strategy)
strategy
- The spatial strategy to use for building the geo shape Querypublic SpatialStrategy strategy()
public GeoShapeQueryBuilder indexedShapeIndex(java.lang.String indexedShapeIndex)
indexedShapeIndex
- Name of the index where the indexed Shape ispublic java.lang.String indexedShapeIndex()
public GeoShapeQueryBuilder indexedShapePath(java.lang.String indexedShapePath)
indexedShapePath
- Path of the field where the Shape itself is definedpublic java.lang.String indexedShapePath()
public GeoShapeQueryBuilder relation(ShapeRelation relation)
relation
- relation of the shapespublic ShapeRelation relation()
public GeoShapeQueryBuilder ignoreUnmapped(boolean ignoreUnmapped)
MatchNoDocsQuery
in place of this query) or throw an exception if
the field is unmapped.public boolean ignoreUnmapped()
MatchNoDocsQuery
in place of this query) or throw an exception if
the field is unmapped.protected org.apache.lucene.search.Query doToQuery(QueryShardContext context)
doToQuery
in class AbstractQueryBuilder<GeoShapeQueryBuilder>
public static org.apache.lucene.spatial.query.SpatialArgs getArgs(ShapeBuilder shape, ShapeRelation relation)
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
doXContent
in class AbstractQueryBuilder<GeoShapeQueryBuilder>
java.io.IOException
public static java.util.Optional<GeoShapeQueryBuilder> fromXContent(QueryParseContext parseContext) throws java.io.IOException
java.io.IOException
protected boolean doEquals(GeoShapeQueryBuilder other)
AbstractQueryBuilder
QueryBuilder
object of the same type is "equal to" this one.doEquals
in class AbstractQueryBuilder<GeoShapeQueryBuilder>
protected int doHashCode()
doHashCode
in class AbstractQueryBuilder<GeoShapeQueryBuilder>
public java.lang.String getWriteableName()
NamedWriteable
protected QueryBuilder doRewrite(QueryRewriteContext queryShardContext) throws java.io.IOException
doRewrite
in class AbstractQueryBuilder<GeoShapeQueryBuilder>
java.io.IOException