0

I 'm new with ealsticsearch and I use a third party ealsticsearch im trying to make query using spring data it's work with all of string fields but when i try to make query with a timestamps field I get an error :

this my query :

{
...
  "transmissionTime": "2021-09-08 11:53:00.000",
...
}

this's my field mapping

@JsonFormat(
        shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd@HH:mm:ss.SSSZ", locale = "fr_FR")
private Timestamp transmission_date_and_time;

when I execute my query i get this error :

Caused by: org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=illegal_argument_exception, reason=failed to parse date field [1631098380000] with format [yyyy-MM-dd@HH:mm:ss.SSSZ]]
1
  • Spring Data Elasticsearch does not use Jackson annotations (at least not since version 4.0). Which version do you use? Commented Apr 2, 2021 at 17:29

1 Answer 1

2

Modify your index mapping as

{
  "mappings": {
    "properties": {
      "timestamp": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss.SSS"
      }
    }
  }
}
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.