I am trying to use Elasticsearch for GO with this well-known repo
However, when I am trying to create an index
(docs, and also given as an example here):
// Define an elastic client
client, err := elastic.NewClient(elastic.SetURL("host1"))
if err != nil {
client, err := elastic.NewClient(elastic.SetURL("host2"))
if err != nil {
fmt.Println("Error when connecting Elasticsearch host");
}
}
// Create an index
_, err = client.CreateIndex("events").Do()
if err != nil {
fmt.Println("Error when creating Elasticsearch index");
panic(err)
}
I got the following error, which I do not understand:
not enough arguments in call to client.CreateIndex("events").Do
Why is that? What do I miss here?