go-stash icon indicating copy to clipboard operation
go-stash copied to clipboard

写入elasticsearch 8.2.2提示这个

Open damuzhi opened this issue 3 years ago • 2 comments
trafficstars

{"@timestamp":"2022-06-09T17:33:05.261+08:00","level":"error","content":"writer.go:60 elastic: Error 400 (Bad Request): Action/metadata line [1] contains an unknown parameter [_type] [type=illegal_argument_exception]"}

damuzhi avatar Jun 09 '22 10:06 damuzhi

代码用的es库是v7的,只支持7.x。

github.com/olivere/elastic/v7 v7.0.32

Zhang21 avatar Sep 06 '22 09:09 Zhang21

我也遇到了这个问题,我注意到有个作者提了PR说是支持 8.x,我试了下他的代码还是报这个错误

mfuuzy avatar Sep 07 '22 12:09 mfuuzy

因为8.x去掉了 _type 字段,所以只需要将writer.go中的 以下代码删除即可 if len(w.docType) > 0 { req = req.Type(w.docType) }

wzlove avatar Jan 30 '24 03:01 wzlove

因为8.x去掉了 _type 字段,所以只需要将writer.go中的 以下代码删除即可 if len(w.docType) > 0 { req = req.Type(w.docType) }

Submit a PR? Thanks!

kevwan avatar Jan 30 '24 04:01 kevwan

因为8.x去掉了 _type 字段,所以只需要将writer.go中的 以下代码删除即可 if len(w.docType) > 0 { req = req.Type(w.docType) }

Submit a PR? Thanks!

https://github.com/kevwan/go-stash/pull/43

wzlove avatar Jan 30 '24 07:01 wzlove

fixed by #43

kevwan avatar Feb 02 '24 01:02 kevwan