Package org.elasticsearch.index.mapper
Class ConstantFieldType
java.lang.Object
org.elasticsearch.index.mapper.MappedFieldType
org.elasticsearch.index.mapper.ConstantFieldType
public abstract class ConstantFieldType extends MappedFieldType
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.Relation -
Constructor Summary
Constructors Constructor Description ConstantFieldType(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> meta) -
Method Summary
Modifier and Type Method Description booleanisAggregatable()Returns true if the field is aggregatable.booleanisSearchable()Returns true if the field is searchable.protected abstract booleanmatches(java.lang.String pattern, QueryShardContext 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(java.lang.String prefix, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, QueryShardContext context)org.apache.lucene.search.QuerytermQuery(java.lang.Object value, QueryShardContext context)Generates a query that will only match documents that contain the given value.org.apache.lucene.search.QuerytermsQuery(java.util.List<?> values, QueryShardContext context)Build a constant-scoring query that matches all values.org.apache.lucene.search.QuerywildcardQuery(java.lang.String value, org.apache.lucene.search.MultiTermQuery.RewriteMethod method, QueryShardContext context)Methods inherited from class org.elasticsearch.index.mapper.MappedFieldType
boost, docValueFormat, eagerGlobalOrdinals, existsQuery, extractTerm, failIfNoDocValues, failIfNotIndexed, familyTypeName, fielddataBuilder, fuzzyQuery, getTextSearchInfo, hasDocValues, indexAnalyzer, intervals, isFieldWithinQuery, meta, multiPhraseQuery, name, phrasePrefixQuery, phraseQuery, pointReaderIfPossible, rangeQuery, regexpQuery, setBoost, setEagerGlobalOrdinals, setIndexAnalyzer, spanPrefixQuery, typeName, updateMeta, valueForDisplay
-
Constructor Details
-
ConstantFieldType
public ConstantFieldType(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> meta)
-
-
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
Return whether the constant value of this field matches the providedpatternas documented inRegex.simpleMatch(java.lang.String, java.lang.String). -
termQuery
public final org.apache.lucene.search.Query termQuery(java.lang.Object value, QueryShardContext context)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
-
termsQuery
public final org.apache.lucene.search.Query termsQuery(java.util.List<?> values, QueryShardContext 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.QueryShardContext).- Overrides:
termsQueryin classMappedFieldType
-
prefixQuery
public final org.apache.lucene.search.Query prefixQuery(java.lang.String prefix, @Nullable org.apache.lucene.search.MultiTermQuery.RewriteMethod method, QueryShardContext context)- Overrides:
prefixQueryin classMappedFieldType
-
wildcardQuery
public final org.apache.lucene.search.Query wildcardQuery(java.lang.String value, @Nullable org.apache.lucene.search.MultiTermQuery.RewriteMethod method, QueryShardContext context)- Overrides:
wildcardQueryin classMappedFieldType
-