You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Then I try to put the mapping of the document to the index
One cannot update the mapping for an existing field in Elasticsearch.
Besides not being able to change the mapping, do you get errors when writing or reading data with Spring Data Elasticsearch?
I do not want to change the mapping! I only execute PutMapping to ensure that the mapping I have in code is up to date with the index.
The only thing that I want is to use spring data elasticsearch with the existing index. However, I do not see a way in which I can annotate my DTO with @field in a way that the mapping generated is the same as the existing mapping.
Maybe I was a bit unclear. Asked differently. I have the following existing property in my mapping: "dueDate" :{"type":"date" }
which is equivalent to: "dueDate" :{"type":"date","format":"strict_date_optional_time||epoch_millis" }
How can I annotate my DTO with @field to comply to this mapping?
There is no field type for strict_date_optional_time so the closest I could get was this: "dueDate" :{"type":"date","format":"date_optional_time||epoch_millis"}
Which is what happens if I don't put the format parameter in the @field annotation
Short version: I did not manage to map the date format "strict_date_optional_time||epoch_millis" with the provided annotations.
Extended explanation:
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.
The text was updated successfully, but these errors were encountered: