I am using this library in go as Elasticsearch client: https://pkg.go.dev/github.com/elastic/go-elasticsearch/esapi#IndicesCreate.WithBody
I have a problem on creating a new index with this library. The doc says this method:
type IndicesCreate func(index string, o ...func(*IndicesCreateRequest)) (*Response, error)
which looks like the one I can use to create the index. But I am new to go and not sure how to pass the second parameter.
Below is my code:
req := esapi.IndicesCreateRequest{
Index: indexName,
}
esapi.IndicesCreate(indexName, &req)
but I got too many arguments in conversion to esapi.IndicesCreate error message. What is the right way to do it?