我需要保存一些数据,其中包含一个名为ID的字段,这是一个使用golang和Olivere弹性搜索包的uuid im,这是我的代码
type Space struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
}
进行一些转换后
js := string(data)
// upto this place there is no error or warnings
ind, err := esclient.Index().
Index(Type).
BodyJson(js).
Do(ctx)
这是它引发的错误
无法解析ID为'gPmI8HIBCIO6Ejb-Y51D'的文档中[long]类型的字段[id]。字段值的预览:“ a5c723c5-1f6e-457f-9556-47b7ebcfd183”
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句