2
  1. springboot version:2.5.2
  2. elasticsearch version:7.3.0
  3. elasticsearch-client: rest-hight-level
  4. the entity
    @Id
    public String id;
    public long uid;
    public long tid;
    public int type;
    public int recordType;
    public int code;
    public double cost;
    public double costNonpay;
    public int costType;
    public String remark;
    @Field(type = FieldType.Date, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z")
    public Date time;
  1. error org.springframework.data.elasticsearch.core.convert.ConversionException: Unable to parse date value '2021-02-21T14:19:27+08:00' of property 'Trade.time' with configured converters

1 Answer 1

2

The date time string you have represent with offset you can use OffsetDateTime to parse the string with custom pattern

@Field(type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd'T'HH:mm:ssz")
public Date time;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.