Skip to content
Oliver Eilhard edited this page Feb 13, 2018 · 3 revisions

The Get service retrieves a document from an index.

// Get tweet with specified ID
ctx := context.Background()
get1, err := client.Get().
    Index("twitter").
    Type("tweet").
    Id("1").
    Do(ctx)
if err != nil {
    // Handle error
    panic(err)
}
if get1.Found {
    fmt.Printf("Got document %s in version %d from index %s, type %s\n", get1.Id, get1.Version, get1.Index, get1.Type)
}
Clone this wiki locally