basic_time Exception with Spring-Data-elasticsearch:4.4.18

36 views Asked by At

Hello dear community,

I have migrated from Spring-data-elasticsearch:3.x to 4.4.18 and since then I get this error:

Caused by: java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract
org.springframework.data.elasticsearch.annotations.DateFormat[] org.springframework.data.elasticsearch.annotations.Field.format() (Found data of type Lorg/springframework/data/elasticsearch/annotations/DateFormat;.basic_date)

My fields are annotated as follows:

@Field(type = FieldType.Date, format = DateFormat.basic_date)
private LocalDate promotionDateFrom;

Does anyone know in which format these have to be formatted so that I can save dates as a type? Unfortunately, I have not yet been able to find a working solution in the forum.

My query looks like that and should be fine, right? It converts the String to a BASIC_ISO_DATE which should have the same format as the DateFormat.basic_date. Does maybe someone know another problem with the mapping of these types?

String yesterday = getNow().minus(1, ChronoUnit.DAYS).format(DateTimeFormatter.BASIC_ISO_DATE);
      campaignQueryBuilder.must().add(QueryBuilders.rangeQuery("productDateEnd").gte(yesterday));

Thanks for any help :)

0

There are 0 answers