Skip to content

Commit

Permalink
Merge pull request #21 from arthur-jx/master
Browse files Browse the repository at this point in the history
update es optional docType='', support es 8.X
  • Loading branch information
kevwan authored Sep 17, 2022
2 parents 010fdeb + 2c5899e commit 15d7aaa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stash/es/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 15d7aaa

Please sign in to comment.