I am using the typed client of Elasticsearch using the official library. I want to bulk insert multiple documents. How do I do this?
This is what I wrote until now:
bulk := instance.client.Bulk()
for _, doc := range docs {
req := bulk.Index(indexName)
req.CreateOp(types.NewCreateOperation(), doc) // This gives error
}
res, err := bulk.Do(context.Background())