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.
Delete API
editDelete API
editThe 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.
By Id
editclient.Delete<ElasticSearchProject>(1); client.DeleteAsync<ElasticSearchProject>(1);
Delete with custom parameters
editFluent Syntax
editclient.Delete(1, d => d .Type("users") .Index("myindex") );
Object Initializer Syntax
edit// Be explicit with type and index client.Delete(new DeleteRequest("myindex", "users", "1")); // Infer type and index from CLR type client.Delete(new DeleteRequest<ElasticsearchProject>("1"));
By object
editId property is inferred (can be any value type (int, string, float …))
client.Delete(searchProject); client.DeleteAsync(searchProject);
By IEnumerable<T>
editclient.DeleteMany(searchProjects); client.DeleteManyAsync(searchProjects);
By Query
editIndices and Mappings
editSee Delete Mapping and Delete Index
Bulk delete
editSee Bulk API