rangeQuery for Date with java

i made a query with elasticsearch client in java , and when i try to searching a date they give me this erros

Failed to execute phase [query], all shards failed; shardFailures {[-AAmwvoOSUmuCZKhW-SZug][car][0]: RemoteTransportException[[-AAmwvo][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: ElasticsearchParseException[failed to parse date field [Wed Dec 04 00:00:00 GMT+01:00 2019]

my query code is like :

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    String sourceDate = "2019-12-04T00:00:00.000Z";


        Date myDate = dateFormat.parse(sourceDate);

 if (query == null) {

                        query = QueryBuilders.boolQuery().must(QueryBuilders.rangeQuery("Date Field")

                                .from(myDate)

                                .to(myDate)

                                .includeLower(true)

                                .includeUpper(false));

                    } else {

                        query = query.must(QueryBuilders.rangeQuery("Date Field")

                                .from(myDate)

                                .to(myDate)
                                .includeLower(true)

                                .includeUpper(false));

            }

any idea about this problem? Thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.