Skip to content

Requests with ReactiveElasticsearchRepository methods doesn't fail if it can't connect with Elasticsearch #1712

Closed
@josemalonsom

Description

@josemalonsom

Spring Boot: 2.3.9.RELEASE
Spring Data Elastic Search: 4.0.7.RELEASE

Problem

When doing a search request with a ReactiveElasticsearchRepository method, as for example findAllById(), if there's no connection with Elasticsearch, for example the cluster is stopped just before the request is made, the connection error is silenced and the request finish correctly but without returning values.

How to reproduce it:

  1. With an Elasticsearch repository prepare a request like:
        List<TestDocument> documents = repository.findAllById(Arrays.asList(ID1, ID2))
                .collectList()
                .block();
  1. Set a breakpoint just before executing the search.
  2. Start the service in debug mode with Elasticsearch running.
  3. Once it stops in the breakpoint stop Elasticsearch.
  4. With Elasticsearch stopped resume the execution.

Result: The request won't fail and an empty list will be returned.

I wasn't able to prepare a test as I couldn't pinpoint exactly where the problem occurs, but I prepared a project with this example TestBug.test(), it's a little clumsy, it requires to stop the execution with a breakpoint, sorry for that, but is the only way I found to reproduce it, I hope it helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions