【发布时间】:2020-06-26 21:13:47
【问题描述】:
我需要保存一些数据,其中包含一个名为 ID 的字段,这是一个 uuid 即时通讯使用 golang 和 olivere 弹性搜索包这是我的代码
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 的文档中类型为 [long] 的字段 [id] 'gPmI8HIBCIO6Ejb-Y51D'。字段值预览: 'a5c723c5-1f6e-457f-9556-47b7ebcfd183'
【问题讨论】:
标签: go elasticsearch