【店小二】公告:
es轉struct
| | |
功能介紹
1.將
mapping
中的properties
內容轉為struct
2.注意是將properties
值作為輸入內容, 如下:
{
"mappings": {
"properties": {
"doc_id": {
"type": "keyword"
},
"id": {
"type": "long"
},
"path": {
"type": "keyword"
},
"name": {
"type": "text"
},
"url": {
"type": "keyword"
},
"description": {
"type": "text"
},
"created_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
示例
{
"doc_id": {
"type": "keyword"
},
"id": {
"type": "long"
},
"path": {
"type": "keyword"
},
"name": {
"type": "text"
},
"url": {
"type": "keyword"
},
"description": {
"type": "text"
},
"created_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
處理後
type GenerateObj struct {
DocId string `json:"doc_id,omitempty"`
Id int64 `json:"id,omitempty"`
Path string `json:"path,omitempty"`
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
Description string `json:"description,omitempty"`
CreatedTime string `json:"created_time,omitempty"`
}