Delete APIedit

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.

By Idedit

client.Delete<ElasticSearchProject>(1);
client.DeleteAsync<ElasticSearchProject>(1);

Delete with custom parametersedit

Fluent Syntaxedit

client.Delete(1, d => d
    .Type("users")
    .Index("myindex")
);

Object Initializer Syntaxedit

// 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 objectedit

Id property is inferred (can be any value type (int, string, float …​))

client.Delete(searchProject);
client.DeleteAsync(searchProject);

By IEnumerable<T>edit

client.DeleteMany(searchProjects);
client.DeleteManyAsync(searchProjects);

By Queryedit

See deleting by query

Indices and Mappingsedit

See Delete Mapping and Delete Index

Bulk deleteedit

See Bulk API