Allow customization of date format

Description

See the list of supported formats: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#strict-date-time

Would be a nice improvement to let users customize the format.

We could offer a way to customize on a per-field basis. See org.hibernate.search.engine.backend.types.dsl.IndexFieldTypeFactory: the idea would be to make asLocalDate et. al. return a specialized context that allows setting the format, at least in the Elasticsearch case.

Alternatively we could provide a configuration option to simply set defaults for each Java type, similar to what we’re doing in org.hibernate.search.backend.elasticsearch.types.format.impl.Elasticsearch7DefaultFieldFormatProvider ; that would certainly be useful in cases like this: https://discourse.hibernate.org/t/hibernate-search-6-index-aliases/3246/15?u=yrodiere

Maybe at some point we could allow it for Lucene too, but that's not really a priority.

Environment

None

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure