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 existsedit
Used to check if the index (indices) exists or not.
Examplesedit
Fluent Syntaxedit
var result = client.IndexExists(i => i.Index("myindex"));
Object Initializer Syntaxedit
var request = new IndexExistsRequest("myindex"); var result = client.IndexExists(request);
Handling the Index Exists responseedit
result
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
.