This is the official Go client library for Elasticsearch, it's currently a work in progress so please check back later. For clients in other languages see this page.
Install the client
package from GitHub:
go get github.com/elastic/go-elasticsearch/client
or install it from a source code checkout:
git clone https://github.com/elastic/go-elasticsearch.git
go install ./client
import "github.com/elastic/go-elasticsearch/client"
c, _ = client.New(client.WithHosts([]string{"https://elasticsearch:9200"}))
body := map[string]interface{}{
"query": map[string]interface{}{
"term": map[string]interface{}{
"user": "kimchy",
},
},
}
resp, err := c.Search(body)