Opensearch Reindex with Date field format change

17 Views Asked by At

We are migrating from ElasticSearch-client(4) to Opensearch-client 1.3 (which intenally uses ElasticSearch-client 5).

New ElasticSearch 5 (internally used by opensearch 1.3), the org.springframework.data.elasticsearch.annotations.DateFormat.custom is deprecated and is no longer available. Planning to change from DateFormat.custom to DateFormat.date_hour_minute_second_millis

In my Index I have an old field

@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "MM-dd-uuuu'T'HH:mm:ss.SSS")
@JsonFormat(pattern = "MM-dd-uuuu'T'HH:mm:ss.SSS")
private LocalDateTime eventDateTime;

Planning to change this field to a new field -

@Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second_millis, pattern = "uuuu-MM-dd'T'HH:mm:ss.SSS")
@JsonFormat(pattern = "uuuu-MM-dd'T'HH:mm:ss.SSS")
private LocalDateTime eventDateTime;

So,

  1. Question 1 - I guess reindexing is only the option as i cannot lose the old data.
  2. Question 2 - If Reindexing is the option, how can i achieve this using opensearch high rest client? Any sample code would help.
0

There are 0 best solutions below