Skip to content

CriteriaQueryProcessor.queryFor(): NOT_IN with Iterable on date field incorrectly handled in 5.5.x (works on main) – request backport #3202

@eeoos

Description

@eeoos

CriteriaQueryProcessor.queryFor() in Spring Data Elasticsearch 5.5.x does not correctly handle Criteria.where("field").not().in(list) .

Even when list is a valid Iterable (e.g. ["2025-01-01", "2025-01-02"]),
the processor converts the Iterable into a single escaped string internally, causing the following

Object value = key.hasValue() ? entry.getValue() : null;
String searchText = value != null ? escape(value.toString()) : "UNKNOWN_VALUE";

exception:

CriteriaQueryException: value for reservedDates is not an Iterable

This makes NOT_IN unusable for date-array fields in all 5.5.x versions.

The implementation of queryFor() on the main branch no longer uses the incorrect escape(value.toString()) logic, so the issue does not occur there. However, Spring Boot 3.5.x still depends on Spring Data Elasticsearch 5.5.x, where the problem remains unresolved. As a result, applications on Boot 3.5.x cannot use CriteriaQuery with NOT_IN, even though the equivalent Elasticsearch DSL works correctly when executed via NativeQuery.

Request

Please backport the corrected queryFor() implementation from main into the 5.5.x line so that it is available for all Spring Boot 3.5.x users.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions