Hi,
I am using Spring Boot Elasticsearch and I have something like this:
Optional<List<Evento>> findByClienteIdAndDataEqualsAndLogLike(Integer id, String eventDate, String log, Pageable pageable);
This eventDate has this format 'dd/MM/yyyy HH:mm', so if I call it like this:
this.eventoRepository.findByClienteIdAndDataEqualsAndLogLike(11, "18/03/2017 20:55", "logout", PageRequest.of(0, 1000, Sort.by(Sort.Direction.DESC, "data")));
It works!!
But if call like this:
this.eventoRepository.findByClienteIdAndDataEqualsAndLogLike(11, "18/03/2017", "logout", PageRequest.of(0, 1000, Sort.by(Sort.Direction.DESC, "data")));
It doesn't work because it complains about the format:
ElasticsearchParseException[failed to parse date field [18] with format [dd/MM/yyyy HH:mm]: [failed to parse date field [18] with format [dd/MM/yyyy HH:mm]]]; nested: IllegalArgumentException[failed to parse date field [18] with format [dd/MM/yyyy HH:mm]]; nested: NotSerializableExceptionWrapper[date_time_parse_exception: Text '18' could not be parsed at index 2];
I want is to search using only the month and the year, as "bring me everything from this client on March of 2019".
Or, yet, using the complete date, such as "18/03/2017".
Any word on how I would do that?