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
editIndices exists
editUsed to check if the index (indices) exists or not.
Examples
editFluent Syntax
editvar result = client.IndexExists(i => i.Index("myindex"));
Object Initializer Syntax
editvar 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
.