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.

Indices.Exists returns false even if the index exists for ES 7.2.0

See original GitHub issue

NEST/Elasticsearch.Net version: 7.0.1 Elasticsearch version: 7.2.0 Description of the problem including expected versus actual behavior: Regardless of whether the index exists or not the function

Indices.Exists("IndexName").Exists

always returns false.

This can be observed for Indices.ExistsAsync too.

image

Calling HEAD accesslogs in the dev console will return “200 - OK”

Steps to reproduce:

  1. Create an index in dev console
  2. Write a console app that calls “Indices.Exists().Exists” function for index created in step 1
  3. Observe that the return is false instead of expected true

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
ffMathycommented, Jun 16, 2021

Same problem here. It has re-emerged. Also .NET Core and latest NEST.

1reaction
jwagoncommented, Aug 9, 2019

I am reproducing this consistently with Elasticsearch 7.3.0 and NEST 7.1.0

With code like:

var result = _client.Indices.Exists("ms-core-integration-test");

result.IsValid comes back false, as does result.Exists. result.ServerError is null.

The index definitely exists, I can see (returns 200) it when calling

HEAD /ms-core-integration-test

I am getting this response:


FailureReason: BadResponse while attempting HEAD on https://XXXXXXXX.us-east-1.aws.found.io:9243/ms-core-integration-test

Audit trail of this API call:
- [1] BadResponse: Node: https://XXXXXXXX.us-east-1.aws.found.io:9243/ Took: 00:00:00.0230221
OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 200 from: HEAD /ms-core-integration-test
Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Response:
> > 
Exception:
Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 200 from: HEAD /ms-core-integration-test

That makes no sense, how can the response be invalid but also return 200?

BTW, other operations (search, actually creating the index, etc.) work fine, so it’s not as if I’m not connecting properly.

This is definitely a bug and the client is not behaving as expected. Please re-open.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Indices.Exists returns false even if the index exists for ES ...
Indices.Exists returns false even if the index exists for ES 7.2.0 · Create an index in dev console · Write a console app...
Read more >
Upgrading to Elastic Search NEST 7.0.1 breaks code that ...
When testing following code with elasticsearch 7.2.0 and NEST 7.0.1 ... Index created, exists?: True Index deleted, exists?: False.
Read more >
Exists API | Elasticsearch Guide [8.9]
Checks if a data stream, index, or alias exists. response = client.indices.exists( ... This behavior applies even if the request targets other open...
Read more >
Exists API | Elasticsearch Guide [7.17]
Checks if a data stream, index, or alias exists. HEAD my-data-stream ... This behavior applies even if the request targets other open indices....
Read more >
API Documentation - Elasticsearch DSL - Read the Docs
Returns True if the index already exists in elasticsearch. Any additional keyword arguments will be passed to Elasticsearch.indices.exists unchanged.
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