Elasticsearch.NET version 7 - How to Check If Index Exists

Viewed 2979

In Elasticsearch.NET 6.x, it is possible to check if index exists using IElasticClient method:

    bool exists = elasticClient.IndexExists("my-index-name").Exists;

Method is removed in Elasticsearch.NET version 7.

1 Answers

In Elasticsearch.NET version 7 methods related to indices operations are moved into IndicesNamespace, so IndexExists method has been moved to:

    bool exists = elasticClient.Indices.Exists("my-index-name").Exists;

Similarly, different methods have been moved to:

  • Cat
  • Cluster
  • Graph
  • Sql
  • Nodes
  • etc...
Related