When using spring-data to insert Elasticsearch document with Date type, I can\'t get right date format, the date format always is Long.
here is the java code: Entity.jav
It worked for me with below settings. Note: delete your index before to test this change. Make sure that the patterns are same at all places.
@Field(type = FieldType.Date, store = true, format = DateFormat.custom, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@JsonFormat (shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
private Date date;