logstash.conf(部分):
output {
elasticsearch {
# ES的IP地址及端口
hosts => ["127.0.0.1:9200"]
# 索引名称 可自定义
index => "test"
pipeline => "attachment"
# 需要关联的数据库中有有一个id字段,对应类型中的id
document_id => "%{id}"
}
stdout {
# JSON格式输出
codec => json_lines
}
}
建立文本抽取管道pipeline(全局执行一次即可使用)
PUT _ingest/pipeline/attachment
{
"description": "Extract attachment information",
"processors": [
{
"attachment": {
"field": "data",
"indexed_chars": -1,
"ignore_missing": true
}
},
{
"remove": {
"field": "data"
}
}
]
}
解决办法