question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetMany returns empty list after connection failure

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
srgclrcommented, Nov 15, 2017

Cool, thanks for the suggestion @russcam. We’ve sorted it out eventually but were caught off guard by the inconsistency.

0reactions
Mpdreamzcommented, Dec 22, 2017

This will be fixed in 6.x onwards as per #2987

Thanks for raising this @srgclr 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeORM Query Builder Returning Empty Array When ...
.getMany() returns type Promise of Entity[], and given the nature of your query, I suspect you are not returning an entity at all....
Read more >
Find returns empty array but SQL query shows correct value
In my case I have 2 TypeOrm connections. When I try to get the entries from the second connection (not the default), it...
Read more >
TypeORM Query Builder Returning ... - appsloveworld.com
getMany () returns type Promise of Entity[], and given the nature of your query, I suspect you are not returning an entity at...
Read more >
returnValue is returning empty list
I'm trying to get a list in a lightning component. In the sandbox and in the community preview in my org i get...
Read more >
Why Did Operation Barbarossa Fail - WW2 1941
In August 1939, Germany and the Soviet Union signed a non-aggression treaty. The Nazi-Soviet Pact coming as a complete surprise to other nations....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found