[Solved] Elasticsearch CreateIndex() not enough arguments


The IndicesCreateService.Do() function expects a context.Context to be passed.

So, you need to import "golang.org/x/net/context" and then change your call to this:

import (
    ... your other imports...    
    "golang.org/x/net/context"
)
...
_, err := client.CreateIndex("events").Do(context.TODO())
                                                ^
                                                |
                                             add this

You can also check the indices_create_test.go test case in order to see how it’s done.

2

solved Elasticsearch CreateIndex() not enough arguments