【发布时间】:2017-11-07 11:37:32
【问题描述】:
我正在构建一个结构来将 put 消息发送到 Elasticsearch 以获取管道附件。
这是我应该发送给 ES 的 json:
PUT _ingest/pipeline/attachment
{
"description": "Process documents",
"processors": [
{
"attachment": {
"field": "thedata",
"indexed_chars": -1
}
},
{
"set": {
"field": "attachment.title",
"value": "{{ title }}"
}
},
{
"set": {
"field": "attachment.author",
"value": "{{ author }}"
}
},
{
"set": {
"field": "attachment.url",
"value": "{{ url }}"
}
},
{
"set": {
"field": "attachment.cover",
"value": "{{ cover }}"
}
},
{
"set": {
"field": "attachment.page",
"value": "{{ page }}"
}
}
]
}
我真的需要创建一个结构并将其编组以放置消息吗? (我来自 Python)。设置管道是一个单一的时间过程。
我在 Go 中构建这样的结构:
type AS struct {
Description string
}
type ASP struct {
Processors
}
type ASPA struct {
Attachment []ASPAF `json:"attachment"`
}
type ASPAF struct {
Field string `json:"field"`
IndexedChars uint64 `json:"indexed_chars"`
}
type ASPS struct {
Set []ASPSF `json:"set"`
}
type ASPSF struct {
Field string `json:"field"`
Value string `json:"value"`
}
如果你能看到代码,我会被困在ASP struct 和AS struct 处理器和四舍五入作为带有描述的附件结构。
有人可以指导我吗?我什至不确定我对上述结构是否正确。
谢谢!
【问题讨论】:
标签: elasticsearch go