java.lang.Object
org.elasticsearch.index.mapper.MappedFieldType
org.elasticsearch.index.mapper.SimpleMappedFieldType
org.elasticsearch.index.mapper.TermBasedFieldType
org.elasticsearch.index.mapper.StringFieldType
- Direct Known Subclasses:
FlattenedFieldMapper.KeyedFlattenedFieldType,FlattenedFieldMapper.RootFlattenedFieldType,IgnoredFieldMapper.IgnoredFieldType,IgnoredFieldMapper.LegacyIgnoredFieldType,NestedPathFieldMapper.NestedPathFieldType,TextFamilyFieldType
Base class for
MappedFieldType implementations that use the same
representation for internal index terms as the external representation so
that partial matching queries such as prefix, wildcard and fuzzy queries
can be implemented.
Circuit breaker accounting for automaton-based queries (prefix, wildcard, regexp, range)
is performed here, at the point each individual Lucene query is created, rather than solely
in SearchExecutionContext.toQuery(org.elasticsearch.index.query.QueryBuilder) after the full query tree is assembled. This is
intentional: compound queries such as a bool with many wildcard clauses build each
clause sequentially, so by the time the complete tree is available for a post-hoc walk every
automaton has already been allocated. Accounting per-clause lets the circuit breaker trip as
soon as cumulative memory crosses the threshold, preventing the remaining clauses from being
constructed and avoiding a potential OOM.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.MappedFieldType
MappedFieldType.BlockLoaderContext, MappedFieldType.CollapseType, MappedFieldType.FielddataOperation, MappedFieldType.FieldExtractPreference, MappedFieldType.Relation -
Field Summary
Fields inherited from class org.elasticsearch.index.mapper.TermBasedFieldType
textSearchInfoFields inherited from class org.elasticsearch.index.mapper.MappedFieldType
indexType -
Constructor Summary
ConstructorsConstructorDescriptionStringFieldType(String name, IndexType indexType, boolean isStored, TextSearchInfo textSearchInfo, Map<String, String> meta) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.QueryfuzzyQuery(Object value, Fuzziness fuzziness, int prefixLength, int maxExpansions, boolean transpositions, SearchExecutionContext context, org.apache.lucene.search.MultiTermQuery.RewriteMethod rewriteMethod) org.apache.lucene.search.QuerynormalizedWildcardQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, SearchExecutionContext context) static final StringnormalizeWildcardPattern(String fieldname, String value, org.apache.lucene.analysis.Analyzer normalizer) org.apache.lucene.search.QueryprefixQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context) org.apache.lucene.search.QueryrangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, SearchExecutionContext context) Same asSimpleMappedFieldType.rangeQuery(Object, Object, boolean, boolean, ShapeRelation, ZoneId, DateMathParser, SearchExecutionContext)but without the trouble of relations or date-specific options.org.apache.lucene.search.QueryregexpQuery(String value, int syntaxFlags, int matchFlags, int maxDeterminizedStates, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, SearchExecutionContext context) protected org.apache.lucene.search.QuerywildcardQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, boolean shouldNormalize, SearchExecutionContext context) org.apache.lucene.search.QuerywildcardQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context) Methods inherited from class org.elasticsearch.index.mapper.TermBasedFieldType
getTextSearchInfo, indexedValueForSearch, mayExistInIndex, termQuery, termQueryCaseInsensitive, termsQueryMethods inherited from class org.elasticsearch.index.mapper.SimpleMappedFieldType
rangeQueryMethods inherited from class org.elasticsearch.index.mapper.MappedFieldType
automatonQuery, blockLoader, checkNoFormat, checkNoTimeZone, collapseType, dimensions, distanceFeatureQuery, docValueFormat, eagerGlobalOrdinals, existsQuery, failIfNoDocValues, failIfNotIndexed, failIfNotIndexedNorDocValuesFallback, familyTypeName, fielddataBuilder, fieldHasValue, fuzzyQuery, getDefaultHighlighter, getMetricType, getTerms, hasDocValues, hasScriptValues, indexType, isAggregatable, isDimension, isFieldWithinQuery, isSearchable, isStored, isVectorEmbedding, meta, multiPhraseQuery, name, phrasePrefixQuery, phraseQuery, pointReaderIfPossible, prefixQuery, spanPrefixQuery, supportsBlockLoaderConfig, typeName, validateMatchedRoutingPath, valueFetcher, valueForDisplay, wildcardLikeQuery, wildcardQuery
-
Constructor Details
-
StringFieldType
-
-
Method Details
-
fuzzyQuery
public org.apache.lucene.search.Query fuzzyQuery(Object value, Fuzziness fuzziness, int prefixLength, int maxExpansions, boolean transpositions, SearchExecutionContext context, @Nullable org.apache.lucene.search.MultiTermQuery.RewriteMethod rewriteMethod) - Overrides:
fuzzyQueryin classMappedFieldType
-
prefixQuery
public org.apache.lucene.search.Query prefixQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context) - Overrides:
prefixQueryin classMappedFieldType
-
normalizeWildcardPattern
-
wildcardQuery
public org.apache.lucene.search.Query wildcardQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context) - Overrides:
wildcardQueryin classMappedFieldType
-
normalizedWildcardQuery
public org.apache.lucene.search.Query normalizedWildcardQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, SearchExecutionContext context) - Overrides:
normalizedWildcardQueryin classMappedFieldType
-
wildcardQuery
protected org.apache.lucene.search.Query wildcardQuery(String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, boolean shouldNormalize, SearchExecutionContext context) -
regexpQuery
public org.apache.lucene.search.Query regexpQuery(String value, int syntaxFlags, int matchFlags, int maxDeterminizedStates, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, SearchExecutionContext context) - Overrides:
regexpQueryin classMappedFieldType
-
rangeQuery
public org.apache.lucene.search.Query rangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper, SearchExecutionContext context) Description copied from class:SimpleMappedFieldTypeSame asSimpleMappedFieldType.rangeQuery(Object, Object, boolean, boolean, ShapeRelation, ZoneId, DateMathParser, SearchExecutionContext)but without the trouble of relations or date-specific options.- Overrides:
rangeQueryin classSimpleMappedFieldType
-