Closed
Description
Short version: I did not manage to map the date format "strict_date_optional_time||epoch_millis" with the provided annotations.
Extended explanation:
- I have an existing Elasticsearch index with a date field. The date field was created without specifying a format so it has the elasticsearch default of "strict_date_optional_time||epoch_millis" (see here https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html)
- I then created a @Document-annotated class where I annotate the date field with just @field(type = FieldType.Date).
- Then I try to put the mapping of the document to the index and get the Exception: "Mapper for XXX conflicts with existing mapper: Cannot update parameter [format] from [strict_date_optional_time||epoch_millis] to [date_optional_time||epoch_millis]"
- I then also had to find out that I cannot provide the existing format to the annotation @field(type = FieldType.Date, format = ???) because DateFormat does not contain the strict formats.
So I could not find a way to have a strict date format (besides the one with nanos that was added in this issue #2676).
In my opinion annotating @field(type = FieldType.Date) should have the same effect as specifying a date in the mapping without format so should lead implicitely to "strict_date_optional_time||epoch_millis". In addition I think it would make sense for the DateFormat Enum to contain all Elasticsearch supplied values including the strict versions even if from a parsing perspective they are very similar.