Skip to content

GetMany returns empty list after connection failure #2897

@srgclr

Description

@srgclr

NEST/Elasticsearch.Net version: 5.5.0
Elasticsearch version: 5.5.1

If I start with either elasticsearch down or simulated connection failures (using Fiddler to auto respond with 502) I'll get a PipelineException on the first GetMany. If I start with a working cluster, which succeeds on the first call, and then close the connection or kill elastic before the second call, it will not throw an exception but return empty list instead.

The low level client returns an unsuccessful response in the second case which is good but the inconsistency in throwing was causing us to miss exceptions if the access to the cluster becomes unstable.

I know exceptions are off in the connection string but returning an empty list is very misleading?

Thanks.

Steps to reproduce:

var serverLocation = "localhost:9200";
var uri = new Uri("http://" + serverLocation);
var sniffingConnectionPool = new SniffingConnectionPool(new List<Uri>() { uri });
var connectionSettings = new ConnectionSettings(sniffingConnectionPool);

connectionSettings
                .DisableDirectStreaming()
                .SniffOnConnectionFault()
                .SniffLifeSpan(TimeSpan.FromSeconds(300));

var client = new ElasticClient(connectionSettings);
var ids = new List<string> { "123" };
var postData = new Dictionary<string, IEnumerable<string>> { { "ids", ids } };

var index = "index";
var type = "type";

IEnumerable<IMultiGetHit<object>> response1 = client.GetMany<object>(ids, index, type);

// stop elastic 
Thread.Sleep(5000);

IEnumerable<IMultiGetHit<object>> response2 = client.GetMany<object>(ids, index, type);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions