WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Indices exists
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Indices exists
editUsed to check if the index (indices) exists or not.
Examples
editFluent Syntax
edit var result = client.IndexExists(i => i.Index("myindex"));
Object Initializer Syntax
edit var request = new IndexExistsRequest("myindex");
var result = client.IndexExists(request);
Handling the Index Exists response
editresult in the above examples is an IExistsResponse which contains a bool property Exists.
One thing to note is that if an index does not exist, Elasticsearch will return a 404.
In this case, a 404 is a valid response and thus result.IsValid will be true.