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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the field is aggregatable.boolean
Returns true if the field is searchable.protected abstract boolean
matches(String pattern, boolean caseInsensitive, SearchExecutionContext context)
Return whether the constant value of this field matches the providedpattern
as documented inRegex.simpleMatch(java.lang.String, java.lang.String)
.org.apache.lucene.search.Query
prefixQuery(String prefix, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context)
org.apache.lucene.search.Query
termQuery(Object value, SearchExecutionContext context)
Generates a query that will only match documents that contain the given value.org.apache.lucene.search.Query
termQueryCaseInsensitive(Object value, SearchExecutionContext context)
org.apache.lucene.search.Query
termsQuery(Collection<?> values, SearchExecutionContext context)
Build a constant-scoring query that matches all values.org.apache.lucene.search.Query
wildcardQuery(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:MappedFieldType
Returns true if the field is searchable.- Overrides:
isSearchable
in classMappedFieldType
-
isAggregatable
public final boolean isAggregatable()Description copied from class:MappedFieldType
Returns true if the field is aggregatable.- Overrides:
isAggregatable
in classMappedFieldType
-
matches
protected abstract boolean matches(String pattern, boolean caseInsensitive, SearchExecutionContext context)Return whether the constant value of this field matches the providedpattern
as documented inRegex.simpleMatch(java.lang.String, java.lang.String)
. -
termQuery
Description copied from class:MappedFieldType
Generates a query that will only match documents that contain the given value. The default implementation returns aTermQuery
over the value bytes, boosted byMappedFieldType.boost()
.- Specified by:
termQuery
in classMappedFieldType
-
termQueryCaseInsensitive
public final org.apache.lucene.search.Query termQueryCaseInsensitive(Object value, SearchExecutionContext context)- Overrides:
termQueryCaseInsensitive
in classMappedFieldType
-
termsQuery
public final org.apache.lucene.search.Query termsQuery(Collection<?> values, SearchExecutionContext context)Description copied from class:MappedFieldType
Build a constant-scoring query that matches all values. The default implementation uses aConstantScoreQuery
around aBooleanQuery
whoseBooleanClause.Occur.SHOULD
clauses are generated withMappedFieldType.termQuery(java.lang.Object, org.elasticsearch.index.query.SearchExecutionContext)
.- Overrides:
termsQuery
in 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:
prefixQuery
in 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:
wildcardQuery
in classMappedFieldType
-