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

Services are the functional units that enable you to interact with Elasticsearch. To invoke a service, you need to have a client first.

Services usually come with a variety of methods to prepare the query and a Do function to execute it against the Elasticsearch REST interface and return a response. Here is an example of the IndexExists service that checks if a given index already exists.

exists, err := client.IndexExists("twitter").Do(context.Background())
if err != nil {
    // Handle error
}
if !exists {
    // Index does not exist yet.
}

Services

Clone this wiki locally