Class Elasticsearch6DefaultFieldFormatProvider
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.types.format.impl.Elasticsearch6DefaultFieldFormatProvider
-
- All Implemented Interfaces:
ElasticsearchDefaultFieldFormatProvider
public class Elasticsearch6DefaultFieldFormatProvider extends Object implements ElasticsearchDefaultFieldFormatProvider
The default field format provider for Elasticsearch 6.Elasticsearch 6 and below expect Joda time patterns as a format, whose syntax is different from the one used in java.time.
In particular:
- ZZ means "offset with colon"
- ZZZ means "zone ID"
- When parsing, yyyy does not accept more than 4 digits, so we need to add an alternative format with nine "y"
- When parsing, SSS does not accept more than 3 digits, so we need to add an alternative format with nine "S"
We do not use Elasticsearch built-in formats ("strict_date_time", ...) because they do not always match the formatters used in Hibernate Search: for example they sometimes define an offset without a colon, whereas we send offsets with a colon, or a year-of-era (~ absolute value of the year) instead of year (which can be negative).
-
-
Constructor Summary
Constructors Constructor Description Elasticsearch6DefaultFieldFormatProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateTimeFormattergetDefaultDateTimeFormatter(Class<? extends TemporalAccessor> fieldType)List<String>getDefaultMappingFormat(Class<? extends TemporalAccessor> fieldType)
-
-
-
Method Detail
-
getDefaultDateTimeFormatter
public DateTimeFormatter getDefaultDateTimeFormatter(Class<? extends TemporalAccessor> fieldType)
- Specified by:
getDefaultDateTimeFormatterin interfaceElasticsearchDefaultFieldFormatProvider
-
getDefaultMappingFormat
public List<String> getDefaultMappingFormat(Class<? extends TemporalAccessor> fieldType)
- Specified by:
getDefaultMappingFormatin interfaceElasticsearchDefaultFieldFormatProvider
-
-