Package org.elasticsearch.index.mapper
Class ConstantFieldType
java.lang.Object
org.elasticsearch.index.mapper.MappedFieldType
org.elasticsearch.index.mapper.ConstantFieldType
- Direct Known Subclasses:
TypeFieldMapper.TypeFieldType,TypeFieldType
A
MappedFieldType that has the same value for all documents.
Factory methods for queries are called at rewrite time so they should be
cheap. In particular they should not read data from disk or perform a
network call. Furthermore they may only return a MatchAllDocsQuery
or a MatchNoDocsQuery.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.MappedFieldType
MappedFieldType.CollapseType, MappedFieldType.Relation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the field is aggregatable.booleanReturns true if the field is searchable.protected abstract booleanmatches(String pattern, boolean caseInsensitive, SearchExecutionContext context)Return whether the constant value of this field matches the providedpatternas documented inRegex.simpleMatch(java.lang.String, java.lang.String).org.apache.lucene.search.QueryprefixQuery(String prefix, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context)org.apache.lucene.search.QuerytermQuery(Object value, SearchExecutionContext context)Generates a query that will only match documents that contain the given value.org.apache.lucene.search.QuerytermQueryCaseInsensitive(Object value, SearchExecutionContext context)org.apache.lucene.search.QuerytermsQuery(Collection<?> values, SearchExecutionContext context)Build a constant-scoring query that matches all values.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.MappedFieldType
boost, collapseType, distanceFeatureQuery, docValueFormat, eagerGlobalOrdinals, existsQuery, extractTerm, failIfNoDocValues, failIfNotIndexed, familyTypeName, fielddataBuilder, fuzzyIntervals, fuzzyQuery, getTerms, getTextSearchInfo, hasDocValues, isFieldWithinQuery, isStored, meta, multiPhraseQuery, name, normalizedWildcardQuery, phrasePrefixQuery, phraseQuery, pointReaderIfPossible, prefixIntervals, prefixQuery, rangeQuery, regexpQuery, setBoost, spanPrefixQuery, termIntervals, typeName, valueFetcher, valueForDisplay, wildcardIntervals, wildcardQuery
-
Constructor Details
-
ConstantFieldType
-
-
Method Details
-
isSearchable
public final boolean isSearchable()Description copied from class:MappedFieldTypeReturns true if the field is searchable.- Overrides:
isSearchablein classMappedFieldType
-
isAggregatable
public final boolean isAggregatable()Description copied from class:MappedFieldTypeReturns true if the field is aggregatable.- Overrides:
isAggregatablein classMappedFieldType
-
matches
protected abstract boolean matches(String pattern, boolean caseInsensitive, SearchExecutionContext context)Return whether the constant value of this field matches the providedpatternas documented inRegex.simpleMatch(java.lang.String, java.lang.String). -
termQuery
Description copied from class:MappedFieldTypeGenerates a query that will only match documents that contain the given value. The default implementation returns aTermQueryover the value bytes, boosted byMappedFieldType.boost().- Specified by:
termQueryin classMappedFieldType
-
termQueryCaseInsensitive
public final org.apache.lucene.search.Query termQueryCaseInsensitive(Object value, SearchExecutionContext context)- Overrides:
termQueryCaseInsensitivein classMappedFieldType
-
termsQuery
public final org.apache.lucene.search.Query termsQuery(Collection<?> values, SearchExecutionContext context)Description copied from class:MappedFieldTypeBuild a constant-scoring query that matches all values. The default implementation uses aConstantScoreQueryaround aBooleanQuerywhoseBooleanClause.Occur.SHOULDclauses are generated withMappedFieldType.termQuery(java.lang.Object, org.elasticsearch.index.query.SearchExecutionContext).- Overrides:
termsQueryin classMappedFieldType
-
prefixQuery
public final org.apache.lucene.search.Query prefixQuery(String prefix, @Nullable org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context)- Overrides:
prefixQueryin classMappedFieldType
-
wildcardQuery
public final org.apache.lucene.search.Query wildcardQuery(String value, @Nullable org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context)- Overrides:
wildcardQueryin classMappedFieldType
-