Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Complete
-
Affects Version/s: 4.0.4 (Neumann SR4)
-
Fix Version/s: 3.2.11 (Moore SR11), 4.0.5 (Neumann SR5), 4.1 RC2 (2020.0.0)
-
Component/s: Repositories
-
Labels:None
-
Pull Request URL:
Description
If you call AbstractElasticsearchRepository.findAllById(new ArrayList<>()), you get the following error:
Caused by: java.lang.IllegalArgumentException: No Id define for Query at org.springframework.util.Assert.notEmpty(Assert.java:467) at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.multiGet(ElasticsearchRestTemplate.java:173) at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.findAllById(AbstractElasticsearchRepository.java:162)
The documentation of CrudRepository#findAllById interface defines this:
If some or all ids are not found, no entities are returned for these IDs.
I expect this query to return an empty result and not to throw a runtime error.
This problem also applies to custom repository methods that use WhereXYIn filters like:
MyElasticRepository.findAllByNameIn(new ArrayList<>())