Skip to content

Commit

Permalink
update es optional docType='', support es 8.X
Browse files Browse the repository at this point in the history
  • Loading branch information
Liu JiaXiang committed Aug 4, 2022
1 parent 1d3e2d3 commit 2c5899e
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 2c5899e

Please sign in to comment.