spring-projects / spring-data-elasticsearch

Provide support to increase developer productivity in Java when using Elasticsearch. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-elasticsearch/
Apache License 2.0
2.91k stars 1.33k forks source link

Repository queries with IN filters fail with empty input list [DATAES-937] #1512

Closed spring-projects-issues closed 3 years ago

spring-projects-issues commented 4 years ago

Stefan Baur opened DATAES-937 and commented

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<>())


Affects: 4.0.4 (Neumann SR4)

Referenced from: pull request https://github.com/spring-projects/spring-data-elasticsearch/pull/525

Backported to: 4.0.5 (Neumann SR5), 3.2.11 (Moore SR11)

spring-projects-issues commented 4 years ago

sothawo commented

Oliver Drotbohm or Mark Paluch can one of you please delete that spam-attachment? I have not the rights to do so

spring-projects-issues commented 4 years ago

Oliver Drotbohm commented

Done

spring-projects-issues commented 4 years ago

sothawo commented

Oliver Drotbohm is it possible to block this spammer? got one of these spams again

 

spring-projects-issues commented 4 years ago

Oliver Drotbohm commented

I've informed the admins

spring-projects-issues commented 4 years ago

sothawo commented

looking at the systems dashboard this is just happening across different projects as well. Is there a possibility to give admin rights to manage attachments only for one repository? Then I could keep this one clean