Package org.elasticsearch.index.query
Class GeoShapeQueryBuilder
- java.lang.Object
-
- org.elasticsearch.index.query.AbstractQueryBuilder<QB>
-
- org.elasticsearch.index.query.AbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
- org.elasticsearch.index.query.GeoShapeQueryBuilder
-
- All Implemented Interfaces:
NamedWriteable,Writeable,ToXContent,ToXContentObject,QueryBuilder,Rewriteable<QueryBuilder>
public class GeoShapeQueryBuilder extends AbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
DerivedAbstractGeometryQueryBuilderthat builds a lat, lon GeoShape Query
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.index.query.AbstractGeometryQueryBuilder
AbstractGeometryQueryBuilder.ParsedGeometryQueryParams
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEprotected static ParseFieldSTRATEGY_FIELD-
Fields inherited from class org.elasticsearch.index.query.AbstractGeometryQueryBuilder
DEFAULT_IGNORE_UNMAPPED, DEFAULT_SHAPE_FIELD_NAME, DEFAULT_SHAPE_INDEX_NAME, DEFAULT_SHAPE_RELATION, fieldName, IGNORE_UNMAPPED_FIELD, ignoreUnmapped, INDEXED_SHAPE_FIELD, indexedShapeId, indexedShapeIndex, indexedShapePath, indexedShapeRouting, indexedShapeType, relation, RELATION_FIELD, shape, SHAPE_FIELD, SHAPE_ID_FIELD, SHAPE_INDEX_FIELD, SHAPE_PATH_FIELD, SHAPE_ROUTING_FIELD, SHAPE_TYPE_FIELD, supplier, validContentTypes
-
Fields inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName
-
Fields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDS
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description GeoShapeQueryBuilder(java.lang.String fieldName, java.lang.String indexedShapeId)Creates a new GeoShapeQueryBuilder whose Query will be against the given field name and will use the Shape found with the given IDGeoShapeQueryBuilder(java.lang.String fieldName, java.lang.String indexedShapeId, java.lang.String indexedShapeType)Deprecated.useGeoShapeQueryBuilder(String, String)insteadGeoShapeQueryBuilder(java.lang.String fieldName, java.util.function.Supplier<Geometry> shapeSupplier, java.lang.String indexedShapeId, java.lang.String indexedShapeType)GeoShapeQueryBuilder(java.lang.String fieldName, ShapeBuilder shape)Deprecated.useGeoShapeQueryBuilder(String, Geometry)insteadGeoShapeQueryBuilder(java.lang.String fieldName, Geometry shape)Creates a new GeoShapeQueryBuilder whose Query will be against the given field name using the given ShapeGeoShapeQueryBuilder(StreamInput in)
-
Method Summary
Modifier and Type Method Description org.apache.lucene.search.QuerybuildShapeQuery(QueryShardContext context, MappedFieldType fieldType)builds the appropriate lucene shape queryprotected booleandoEquals(GeoShapeQueryBuilder other)Indicates whether some otherQueryBuilderobject of the same type is "equal to" this one.protected intdoHashCode()protected GeoShapeQueryBuilderdoRewrite(QueryRewriteContext queryRewriteContext)voiddoShapeQueryXContent(XContentBuilder builder, ToXContent.Params params)writes the xcontent specific to this shape queryprotected voiddoWriteTo(StreamOutput out)static GeoShapeQueryBuilderfromXContent(XContentParser parser)java.lang.StringgetWriteableName()Returns the name of the writeable objectprotected GeoShapeQueryBuildernewShapeQueryBuilder(java.lang.String fieldName, java.util.function.Supplier<Geometry> shapeSupplier, java.lang.String indexedShapeId, java.lang.String indexedShapeType)creates a new ShapeQueryBuilder from the provided field name, supplier, indexed shape id, and indexed shape typeprotected GeoShapeQueryBuildernewShapeQueryBuilder(java.lang.String fieldName, Geometry shape)creates a new ShapeQueryBuilder from the provided field name and shape builderjava.lang.StringqueryFieldType()returns expected content type for this queryGeoShapeQueryBuilderrelation(ShapeRelation relation)Sets the relation of query shape and indexed shape.SpatialStrategystrategy()GeoShapeQueryBuilderstrategy(SpatialStrategy strategy)Defines which spatial strategy will be used for building the geo shape Query.protected java.util.ListvalidContentTypes()list of content types this shape query is compatible with-
Methods inherited from class org.elasticsearch.index.query.AbstractGeometryQueryBuilder
doEquals, doToQuery, doXContent, fieldName, ignoreUnmapped, ignoreUnmapped, indexedShapeId, indexedShapeIndex, indexedShapeIndex, indexedShapePath, indexedShapePath, indexedShapeRouting, indexedShapeRouting, indexedShapeType, isValidContentType, parsedParamsFromXContent, relation, shape, shape
-
Methods inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, checkNegativeBoost, declareStandardFields, equals, extractInnerHitBuilders, getName, hashCode, parseInnerQueryBuilder, printBoostAndQueryName, queryName, queryName, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeTo
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
STRATEGY_FIELD
protected static final ParseField STRATEGY_FIELD
-
-
Constructor Detail
-
GeoShapeQueryBuilder
public GeoShapeQueryBuilder(java.lang.String fieldName, Geometry shape)Creates a new GeoShapeQueryBuilder whose Query will be against the given field name using the given Shape- Parameters:
fieldName- Name of the field that will be queriedshape- Shape used in the Query
-
GeoShapeQueryBuilder
@Deprecated public GeoShapeQueryBuilder(java.lang.String fieldName, ShapeBuilder shape)Deprecated.useGeoShapeQueryBuilder(String, Geometry)insteadCreates a new GeoShapeQueryBuilder whose Query will be against the given field name using the given Shape- Parameters:
fieldName- Name of the field that will be queriedshape- Shape used in the Query
-
GeoShapeQueryBuilder
public GeoShapeQueryBuilder(java.lang.String fieldName, java.util.function.Supplier<Geometry> shapeSupplier, java.lang.String indexedShapeId, @Nullable java.lang.String indexedShapeType)
-
GeoShapeQueryBuilder
@Deprecated public GeoShapeQueryBuilder(java.lang.String fieldName, java.lang.String indexedShapeId, java.lang.String indexedShapeType)Deprecated.useGeoShapeQueryBuilder(String, String)insteadCreates 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- Parameters:
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 Shapes
-
GeoShapeQueryBuilder
public GeoShapeQueryBuilder(java.lang.String fieldName, java.lang.String indexedShapeId)Creates a new GeoShapeQueryBuilder whose Query will be against the given field name and will use the Shape found with the given ID- Parameters:
fieldName- Name of the field that will be filteredindexedShapeId- ID of the indexed Shape that will be used in the Query
-
GeoShapeQueryBuilder
public GeoShapeQueryBuilder(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
doWriteTo
protected void doWriteTo(StreamOutput out) throws java.io.IOException
- Overrides:
doWriteToin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>- Throws:
java.io.IOException
-
getWriteableName
public java.lang.String getWriteableName()
Description copied from interface:NamedWriteableReturns the name of the writeable object
-
relation
public GeoShapeQueryBuilder relation(ShapeRelation relation)
Sets the relation of query shape and indexed shape.- Overrides:
relationin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>- Parameters:
relation- relation of the shapes- Returns:
- this
-
strategy
public GeoShapeQueryBuilder strategy(SpatialStrategy strategy)
Defines which spatial strategy will be used for building the geo shape Query. When not set, the strategy that will be used will be the one that is associated with the geo shape field in the mappings.- Parameters:
strategy- The spatial strategy to use for building the geo shape Query- Returns:
- this
-
strategy
public SpatialStrategy strategy()
- Returns:
- The spatial strategy to use for building the geo shape Query
-
validContentTypes
protected java.util.List validContentTypes()
Description copied from class:AbstractGeometryQueryBuilderlist of content types this shape query is compatible with- Specified by:
validContentTypesin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
queryFieldType
public java.lang.String queryFieldType()
Description copied from class:AbstractGeometryQueryBuilderreturns expected content type for this query- Specified by:
queryFieldTypein classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
doShapeQueryXContent
public void doShapeQueryXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
Description copied from class:AbstractGeometryQueryBuilderwrites the xcontent specific to this shape query- Specified by:
doShapeQueryXContentin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>- Throws:
java.io.IOException
-
newShapeQueryBuilder
protected GeoShapeQueryBuilder newShapeQueryBuilder(java.lang.String fieldName, Geometry shape)
Description copied from class:AbstractGeometryQueryBuildercreates a new ShapeQueryBuilder from the provided field name and shape builder- Specified by:
newShapeQueryBuilderin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
newShapeQueryBuilder
protected GeoShapeQueryBuilder newShapeQueryBuilder(java.lang.String fieldName, java.util.function.Supplier<Geometry> shapeSupplier, java.lang.String indexedShapeId, java.lang.String indexedShapeType)
Description copied from class:AbstractGeometryQueryBuildercreates a new ShapeQueryBuilder from the provided field name, supplier, indexed shape id, and indexed shape type- Specified by:
newShapeQueryBuilderin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
buildShapeQuery
public org.apache.lucene.search.Query buildShapeQuery(QueryShardContext context, MappedFieldType fieldType)
Description copied from class:AbstractGeometryQueryBuilderbuilds the appropriate lucene shape query- Specified by:
buildShapeQueryin classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
doEquals
protected boolean doEquals(GeoShapeQueryBuilder other)
Description copied from class:AbstractQueryBuilderIndicates whether some otherQueryBuilderobject of the same type is "equal to" this one.- Specified by:
doEqualsin classAbstractQueryBuilder<GeoShapeQueryBuilder>
-
doHashCode
protected int doHashCode()
- Overrides:
doHashCodein classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>
-
doRewrite
protected GeoShapeQueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) throws java.io.IOException
- Overrides:
doRewritein classAbstractGeometryQueryBuilder<GeoShapeQueryBuilder>- Throws:
java.io.IOException
-
fromXContent
public static GeoShapeQueryBuilder fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
-