diff --git a/stash/es/writer.go b/stash/es/writer.go index 266bbe5..a4a93d6 100644 --- a/stash/es/writer.go +++ b/stash/es/writer.go @@ -52,7 +52,11 @@ func (w *Writer) execute(vals []interface{}) { var bulk = w.client.Bulk() for _, val := range vals { pair := val.(valueWithIndex) - req := elastic.NewBulkIndexRequest().Index(pair.index).Type(w.docType).Doc(pair.val) + req := elastic.NewBulkIndexRequest().Index(pair.index) + if len(w.docType) > 0 { + req = req.Type(w.docType) + } + req = req.Doc(pair.val) bulk.Add(req) } resp, err := bulk.Do(context.Background())