Class 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).