Module org.elasticsearch.server
Package org.elasticsearch.index.query
Class AbstractGeometryQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>
java.lang.Object
org.elasticsearch.index.query.AbstractQueryBuilder<QB>
org.elasticsearch.index.query.AbstractGeometryQueryBuilder<QB>
- All Implemented Interfaces:
NamedWriteable,VersionedNamedWriteable,Writeable,QueryBuilder,Rewriteable<QueryBuilder>,ToXContent,ToXContentObject
- Direct Known Subclasses:
GeoShapeQueryBuilder
public abstract class AbstractGeometryQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>
extends AbstractQueryBuilder<QB>
Base
QueryBuilder that builds a Geometry Query-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classlocal class that encapsulates xcontent parsed shape parametersNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default value for ignore_unmapped.static final Stringstatic final Stringstatic final ShapeRelationprotected final Stringprotected static final ParseFieldprotected booleanprotected static final ParseFieldprotected final Stringprotected Stringprotected Stringprotected Stringprotected ShapeRelationprotected static final ParseFieldprotected Geometryprotected static final ParseFieldprotected static final ParseFieldprotected static final ParseFieldprotected static final ParseFieldprotected static final ParseFieldprotected static final 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.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGeometryQueryBuilder(String fieldName, String indexedShapeId) Creates a new ShapeQueryBuilder whose Query will be against the given field name and will use the Shape found with the given IDprotectedAbstractGeometryQueryBuilder(String fieldName, Supplier<Geometry> supplier, String indexedShapeId) AbstractGeometryQueryBuilder(String fieldName, Geometry shape) Creates a new AbstractGeometryQueryBuilder whose Query will be against the given field name using the given ShapeprotectedAbstractGeometryQueryBuilder(String fieldName, Geometry shape, String indexedShapeId) protectedRead from a stream. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.apache.lucene.search.QuerybuildShapeQuery(SearchExecutionContext context, MappedFieldType fieldType) builds the appropriate lucene shape queryprotected booleanIndicates whether some otherQueryBuilderobject of the same type is "equal to" this one.protected intprotected QueryBuilderdoRewrite(QueryRewriteContext queryRewriteContext) protected abstract voiddoShapeQueryXContent(XContentBuilder builder, ToXContent.Params params) writes the xcontent specific to this shape queryprotected org.apache.lucene.search.QuerydoToQuery(SearchExecutionContext context) protected voiddoWriteTo(StreamOutput out) protected voiddoXContent(XContentBuilder builder, ToXContent.Params params) booleanGets whether the query builder will ignore unmapped fields (and run aMatchNoDocsQueryin place of this query) or throw an exception if the field is unmapped.ignoreUnmapped(boolean ignoreUnmapped) Sets whether the query builder should ignore unmapped fields (and run aMatchNoDocsQueryin place of this query) or throw an exception if the field is unmapped.indexedShapeIndex(String indexedShapeIndex) Sets the name of the index where the indexed Shape can be foundindexedShapePath(String indexedShapePath) Sets the path of the field in the indexed Shape document that has the Shape itselfindexedShapeRouting(String indexedShapeRouting) Sets the optional routing to the indexed Shape that will be used in the queryprotected abstract AbstractGeometryQueryBuilder<QB>newShapeQueryBuilder(String fieldName, Supplier<Geometry> shapeSupplier, String indexedShapeId) creates a new ShapeQueryBuilder from the provided field name, supplier and indexed shape idprotected abstract AbstractGeometryQueryBuilder<QB>newShapeQueryBuilder(String fieldName, Geometry shape) creates a new ShapeQueryBuilder from the provided field name and shape builderparsedParamsFromXContent(XContentParser parser, AbstractGeometryQueryBuilder.ParsedGeometryQueryParams params) relation()relation(ShapeRelation relation) Sets the relation of query shape and indexed shape.shape()Sets the shapeBuilder for the query shape.Methods inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, boostAndQueryNameToXContent, checkNegativeBoost, declareStandardFields, equals, extractInnerHitBuilders, getName, hashCode, parseInnerQueryBuilder, parseInnerQueryBuilder, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeQueries, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragmentMethods inherited from interface org.elasticsearch.common.io.stream.VersionedNamedWriteable
getMinimalSupportedVersion, getWriteableName
-
Field Details
-
DEFAULT_SHAPE_INDEX_NAME
- See Also:
-
DEFAULT_SHAPE_FIELD_NAME
- See Also:
-
DEFAULT_SHAPE_RELATION
-
DEFAULT_IGNORE_UNMAPPED
public static final boolean DEFAULT_IGNORE_UNMAPPEDThe default value for ignore_unmapped.- See Also:
-
SHAPE_FIELD
-
RELATION_FIELD
-
INDEXED_SHAPE_FIELD
-
SHAPE_ID_FIELD
-
SHAPE_TYPE_FIELD
-
SHAPE_INDEX_FIELD
-
SHAPE_PATH_FIELD
-
SHAPE_ROUTING_FIELD
-
IGNORE_UNMAPPED_FIELD
-
fieldName
-
supplier
-
indexedShapeId
-
shape
-
indexedShapeIndex
-
indexedShapePath
-
indexedShapeRouting
-
relation
-
ignoreUnmapped
protected boolean ignoreUnmapped
-
-
Constructor Details
-
AbstractGeometryQueryBuilder
Creates a new AbstractGeometryQueryBuilder 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
-
AbstractGeometryQueryBuilder
Creates a new ShapeQueryBuilder 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
-
AbstractGeometryQueryBuilder
-
AbstractGeometryQueryBuilder
-
AbstractGeometryQueryBuilder
Read from a stream.- Throws:
IOException
-
-
Method Details
-
doWriteTo
- Specified by:
doWriteToin classAbstractQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>- Throws:
IOException
-
fieldName
- Returns:
- the name of the field that will be queried
-
shape
Sets the shapeBuilder for the query shape.- Parameters:
geometry- the geometry- Returns:
- this
-
shape
- Returns:
- the shape used in the Query
-
indexedShapeId
- Returns:
- the ID of the indexed Shape that will be used in the Query
-
indexedShapeIndex
Sets the name of the index where the indexed Shape can be found- Parameters:
indexedShapeIndex- Name of the index where the indexed Shape is- Returns:
- this
-
indexedShapeIndex
- Returns:
- the index name for the indexed Shape that will be used in the Query
-
indexedShapePath
Sets the path of the field in the indexed Shape document that has the Shape itself- Parameters:
indexedShapePath- Path of the field where the Shape itself is defined- Returns:
- this
-
indexedShapePath
- Returns:
- the path of the indexed Shape that will be used in the Query
-
indexedShapeRouting
Sets the optional routing to the indexed Shape that will be used in the query- Parameters:
indexedShapeRouting- indexed shape routing- Returns:
- this
-
indexedShapeRouting
- Returns:
- the optional routing to the indexed Shape that will be used in the Query
-
relation
Sets the relation of query shape and indexed shape.- Parameters:
relation- relation of the shapes- Returns:
- this
-
relation
- Returns:
- the relation of query shape and indexed shape to use in the Query
-
ignoreUnmapped
Sets whether the query builder should ignore unmapped fields (and run aMatchNoDocsQueryin place of this query) or throw an exception if the field is unmapped. -
ignoreUnmapped
public boolean ignoreUnmapped()Gets whether the query builder will ignore unmapped fields (and run aMatchNoDocsQueryin place of this query) or throw an exception if the field is unmapped. -
buildShapeQuery
protected abstract org.apache.lucene.search.Query buildShapeQuery(SearchExecutionContext context, MappedFieldType fieldType) builds the appropriate lucene shape query -
doShapeQueryXContent
protected abstract void doShapeQueryXContent(XContentBuilder builder, ToXContent.Params params) throws IOException writes the xcontent specific to this shape query- Throws:
IOException
-
newShapeQueryBuilder
protected abstract AbstractGeometryQueryBuilder<QB> newShapeQueryBuilder(String fieldName, Geometry shape) creates a new ShapeQueryBuilder from the provided field name and shape builder -
newShapeQueryBuilder
protected abstract AbstractGeometryQueryBuilder<QB> newShapeQueryBuilder(String fieldName, Supplier<Geometry> shapeSupplier, String indexedShapeId) creates a new ShapeQueryBuilder from the provided field name, supplier and indexed shape id -
doToQuery
- Specified by:
doToQueryin classAbstractQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>
-
doXContent
- Specified by:
doXContentin classAbstractQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>- Throws:
IOException
-
doEquals
Description copied from class:AbstractQueryBuilderIndicates whether some otherQueryBuilderobject of the same type is "equal to" this one.- Specified by:
doEqualsin classAbstractQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>
-
doHashCode
protected int doHashCode()- Specified by:
doHashCodein classAbstractQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>
-
doRewrite
- Overrides:
doRewritein classAbstractQueryBuilder<QB extends AbstractGeometryQueryBuilder<QB>>- Throws:
IOException
-
parsedParamsFromXContent
public static AbstractGeometryQueryBuilder.ParsedGeometryQueryParams parsedParamsFromXContent(XContentParser parser, AbstractGeometryQueryBuilder.ParsedGeometryQueryParams params) throws IOException - Throws:
IOException
-