Skip to content
Oliver Eilhard edited this page Oct 15, 2020 · 4 revisions

The Delete service removes a document from an index.

// Delete tweet with specified ID
ctx := context.Background()
res, err := client.Delete().
    Index("twitter").
    Type("tweet").
    Id("1").
    Do(ctx)
if err != nil {
    // Handle error
    panic(err)
}
if res.Found {
    fmt.Print("Document deleted from from index\n")
}

Notice that ES 7.x deprecated types, and they're very possibly being removed in ES 8.x.