Skip to content

ElasticsearchClient.Indices.ExistsAsync throws exception if its the first API call. #8304

Closed
@braveyp

Description

@braveyp

Elastic.Clients.Elasticsearch version: 8.15.1

Elasticsearch version: 8.15.0

.NET runtime version: 4.8

Operating system version: Windows11

Description of the problem including expected versus actual behavior:
If you instantiate a new ElasticsearchClient and make a call to Indices.ExistsAsync it fails with an error:

Elastic.Clients.Elasticsearch.UnsupportedProductException: The client noticed that the server is not a supported distribution of Elasticsearch or an unknown product.

If you precede the Indices.ExistsAsync call with a Cluster.HealthCheckAsync call the ExistsAsync call succeeds.

Steps to reproduce:

  1. I created a brand new 8.15 install of elastic search and kibana having stopped my 7.16.x ES running on 9200.

  2. This fails:

    public async Task FailingMethod()
    {
        var settings = new ElasticsearchClientSettings(new Uri("https://localhost:9205"));
        settings.Authentication(new BasicAuthentication("elastic", "<password>"));
        
        var client = new ElasticsearchClient(settings);
        var result2 = await client.Indices.ExistsAsync("test");
    }
    
  3. This succeeds:

    public async Task SuccessfulMethod()
    {
        var settings = new ElasticsearchClientSettings(new Uri("https://localhost:9205"));
        settings.Authentication(new BasicAuthentication("elastic", "<password>"));
        
        var client = new ElasticsearchClient(settings);
        var result = await client.Cluster.HealthAsync();
        var result2 = await client.Indices.ExistsAsync("test");
    }
    
  4. I've not tested with any other API call.

Expected behavior
I wouldn't expect to have to make another API call before the ExistsAsync works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions