template | title | menusection | menuitem |
---|---|---|---|
layout.jade |
Connecting |
core |
delete |
The delete API allows to delete a typed JSON document from a specific index based on its id. See also deleting by query for other ways to delete data.
this.ConnectedClient.Delete<ElasticSearchProject>(searchProject.Id);
this.ConnectedClient.DeleteAsync<ElasticSearchProject>(searchProject.Id);
_client.Delete(request.Id, s => s
.Type("users")
.Index("myindex")
);
Id property is inferred (can be any value type (int, string, float ...))
this.ConnectedClient.Delete(searchProject);
this.ConnectedClient.DeleteAsync(searchProject);
this.ConnectedClient.DeleteMany(searchProjects);
this.ConnectedClient.DeleteManyAsync(searchProjects);
Using bulk parameters you can control the deletion of each individual document further
var bulkedProjects = searchProjects
.Select(d=> new BulkParameters<ElasticSearchProject>(d)
{
Version = d.Version,
VersionType = VersionType.External
}
);
this.ConnectedClient.DeleteMany(bulkedProjects, new SimpleBulkParameters() { Refresh = true });
Please see deleting by query
Please see delete mapping
and delete index