## when i config like this
input {
redis {
host => "127.0.0.1"
port => 6379
key => "logstash:test"
data_type => "list"
codec => "json"
type => "%{[type]}"
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
document_id => "%{[id]}"
action => "%{[action]}"
index => "%{[index]}"
}
}
**
and i set key in redis like this :
**
lpush logstash:test '{"id" :"2","action": "index","name":"test","index":"blog","type":"1"}'
**
in elasticsearch
**
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "blog",
"_type": "1",
"_id": "2",
"_score": 1,
"_source": {
"@timestamp": "2016-11-03T08:54:43.994Z",
"name": "test",
"@version": "1",
"action": "index",
"index": "blog",
"id": "2",
"type": "1"
}
}
]
}
}
but i don't want action ,index ,id ,and type in the field,i only want these as follows
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "blog",
"_type": "1",
"_id": "2",
"_score": 1,
"_source": {
"@timestamp": "2016-11-03T08:54:43.994Z",
"name": "test",
"@version": "1"
}
}
]
}
}
how can i do? thanks
Regards,
Archer