Uploaded image for project: 'Spring Data Elasticsearch'
  1. Spring Data Elasticsearch
  2. DATAES-937

Repository queries with IN filters fail with empty input list

    XMLWordPrintable

    Details

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

        Attachments

          Activity

            People

            Assignee:
            sothawo sothawo
            Reporter:
            s.baur@gmx.ch Stefan Baur
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: