Package org.elasticsearch.index.mapper
Class DateFieldMapper.DateFieldType
- java.lang.Object
-
- org.apache.lucene.document.FieldType
-
- org.elasticsearch.index.mapper.MappedFieldType
-
- org.elasticsearch.index.mapper.DateFieldMapper.DateFieldType
-
- All Implemented Interfaces:
org.apache.lucene.index.IndexableFieldType
- Enclosing class:
- DateFieldMapper
public static final class DateFieldMapper.DateFieldType extends MappedFieldType
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.MappedFieldType
MappedFieldType.Relation
-
-
Field Summary
Fields Modifier and Type Field Description protected DateMathParserdateMathParserprotected DateFormatterdateTimeFormatter
-
Method Summary
Modifier and Type Method Description voidcheckCompatibility(MappedFieldType fieldType, java.util.List<java.lang.String> conflicts, boolean strict)Checks for any conflicts between this field type and other.MappedFieldTypeclone()protected DateMathParserdateMathParser()DateFormatterdateTimeFormatter()DocValueFormatdocValueFormat(java.lang.String format, org.joda.time.DateTimeZone timeZone)Return aDocValueFormatthat can be used to display and parse values as returned by the fielddata API.booleanequals(java.lang.Object o)org.apache.lucene.search.QueryexistsQuery(QueryShardContext context)IndexFieldData.BuilderfielddataBuilder(java.lang.String fullyQualifiedIndexName)Return a fielddata builder for this fieldinthashCode()MappedFieldType.RelationisFieldWithinQuery(org.apache.lucene.index.IndexReader reader, java.lang.Object from, java.lang.Object to, boolean includeLower, boolean includeUpper, org.joda.time.DateTimeZone timeZone, DateMathParser dateParser, QueryRewriteContext context)Return whether all values of the givenIndexReaderare within the range, outside the range or cross the range.longparseToMilliseconds(java.lang.Object value, boolean roundUp, org.joda.time.DateTimeZone zone, DateMathParser forcedDateParser, QueryRewriteContext context)org.apache.lucene.search.QueryrangeQuery(java.lang.Object lowerTerm, java.lang.Object upperTerm, boolean includeLower, boolean includeUpper, ShapeRelation relation, org.joda.time.DateTimeZone timeZone, DateMathParser forcedDateParser, QueryShardContext context)Factory method for range queries.voidsetDateTimeFormatter(DateFormatter dateTimeFormatter)org.apache.lucene.search.QuerytermQuery(java.lang.Object value, QueryShardContext context)Generates a query that will only match documents that contain the given value.java.lang.StringtypeName()Returns the name of this type, as would be specified in mapping propertiesjava.lang.ObjectvalueForDisplay(java.lang.Object value)Given a value that comes from the stored fields API, convert it to the expected type.-
Methods inherited from class org.elasticsearch.index.mapper.MappedFieldType
boost, eagerGlobalOrdinals, extractTerm, failIfNoDocValues, failIfNotIndexed, fuzzyQuery, hasDocValues, indexAnalyzer, isAggregatable, isSearchable, multiPhraseQuery, name, nullValue, nullValueAsString, nullValueQuery, phrasePrefixQuery, phraseQuery, prefixQuery, queryStringTermQuery, regexpQuery, searchAnalyzer, searchQuoteAnalyzer, setBoost, setEagerGlobalOrdinals, setHasDocValues, setIndexAnalyzer, setName, setNullValue, setSearchAnalyzer, setSearchQuoteAnalyzer, setSimilarity, similarity, spanPrefixQuery, termsQuery, wildcardQuery
-
Methods inherited from class org.apache.lucene.document.FieldType
checkIfFrozen, docValuesType, freeze, getAttributes, indexOptions, omitNorms, pointDataDimensionCount, pointIndexDimensionCount, pointNumBytes, putAttribute, setDimensions, setDimensions, setDocValuesType, setIndexOptions, setOmitNorms, setStored, setStoreTermVectorOffsets, setStoreTermVectorPayloads, setStoreTermVectorPositions, setStoreTermVectors, setTokenized, stored, storeTermVectorOffsets, storeTermVectorPayloads, storeTermVectorPositions, storeTermVectors, tokenized, toString
-
-
-
-
Field Detail
-
dateTimeFormatter
protected DateFormatter dateTimeFormatter
-
dateMathParser
protected DateMathParser dateMathParser
-
-
Method Detail
-
clone
public MappedFieldType clone()
- Specified by:
clonein classMappedFieldType
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classMappedFieldType
-
hashCode
public int hashCode()
- Overrides:
hashCodein classMappedFieldType
-
typeName
public java.lang.String typeName()
Description copied from class:MappedFieldTypeReturns the name of this type, as would be specified in mapping properties- Specified by:
typeNamein classMappedFieldType
-
checkCompatibility
public void checkCompatibility(MappedFieldType fieldType, java.util.List<java.lang.String> conflicts, boolean strict)
Description copied from class:MappedFieldTypeChecks for any conflicts between this field type and other. If strict is true, all properties must be equal. Otherwise, only properties which must never change in an index are checked.- Overrides:
checkCompatibilityin classMappedFieldType
-
dateTimeFormatter
public DateFormatter dateTimeFormatter()
-
setDateTimeFormatter
public void setDateTimeFormatter(DateFormatter dateTimeFormatter)
-
dateMathParser
protected DateMathParser dateMathParser()
-
existsQuery
public org.apache.lucene.search.Query existsQuery(QueryShardContext context)
- Specified by:
existsQueryin classMappedFieldType
-
termQuery
public org.apache.lucene.search.Query termQuery(java.lang.Object value, @Nullable 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
-
rangeQuery
public org.apache.lucene.search.Query rangeQuery(java.lang.Object lowerTerm, java.lang.Object upperTerm, boolean includeLower, boolean includeUpper, ShapeRelation relation, @Nullable org.joda.time.DateTimeZone timeZone, @Nullable DateMathParser forcedDateParser, QueryShardContext context)Description copied from class:MappedFieldTypeFactory method for range queries.- Overrides:
rangeQueryin classMappedFieldTyperelation- the relation, nulls should be interpreted like INTERSECTS
-
parseToMilliseconds
public long parseToMilliseconds(java.lang.Object value, boolean roundUp, @Nullable org.joda.time.DateTimeZone zone, @Nullable DateMathParser forcedDateParser, QueryRewriteContext context)
-
isFieldWithinQuery
public MappedFieldType.Relation isFieldWithinQuery(org.apache.lucene.index.IndexReader reader, java.lang.Object from, java.lang.Object to, boolean includeLower, boolean includeUpper, org.joda.time.DateTimeZone timeZone, DateMathParser dateParser, QueryRewriteContext context) throws java.io.IOException
Description copied from class:MappedFieldTypeReturn whether all values of the givenIndexReaderare within the range, outside the range or cross the range. The default implementation returnsMappedFieldType.Relation.INTERSECTS, which is always fine to return when there is no way to check whether values are actually within bounds.- Overrides:
isFieldWithinQueryin classMappedFieldType- Throws:
java.io.IOException
-
fielddataBuilder
public IndexFieldData.Builder fielddataBuilder(java.lang.String fullyQualifiedIndexName)
Description copied from class:MappedFieldTypeReturn a fielddata builder for this field- Overrides:
fielddataBuilderin classMappedFieldType- Parameters:
fullyQualifiedIndexName- the name of the index this field-data is build for
-
valueForDisplay
public java.lang.Object valueForDisplay(java.lang.Object value)
Description copied from class:MappedFieldTypeGiven a value that comes from the stored fields API, convert it to the expected type. For instance a date field would store dates as longs and format it back to a string in this method.- Overrides:
valueForDisplayin classMappedFieldType
-
docValueFormat
public DocValueFormat docValueFormat(@Nullable java.lang.String format, org.joda.time.DateTimeZone timeZone)
Description copied from class:MappedFieldTypeReturn aDocValueFormatthat can be used to display and parse values as returned by the fielddata API. The default implementation returns aDocValueFormat.RAW.- Overrides:
docValueFormatin classMappedFieldType
-
-