Delete API

edit

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 Id

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

Delete with custom parameters

edit

Fluent Syntax

edit
client.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

edit

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 Query

edit

See deleting by query

Indices and Mappings

edit

See Delete Mapping and Delete Index

Bulk delete

edit

See Bulk API