logstash是什么就不介绍了,具体看代码
1.input为elasticsearch
input {
elasticsearch {
hosts => "192.168.1.16:9200" //这里是你es的IP地址和端口号
index => "position" //索引名
size => 10000 //每次刷入的量
query => '{"query":{"bool":{"disable_coord":false,"adjust_pure_negative":true,"boost":1}},"_source":{"includes":["_id","ent_status","formatted_address","dom","city","adcode","level","ent_type","city_code","data_date","update_date","pripid","province","entname","district","location"]}}' //需要查询的条件
scroll => "5m"
docinfo => true
}
}
2.filter对input进来的数据做操作
数据格式如下图
filter {
//上述中lat和lon是里层的数据,需要对location做处理,新增一个属性,json化一下这样就和外层的数据在一个级别,便于我后期取值
mutate {
add_field => {
"local_value" => "%{location}"
}
}
json {
source => "local_value"
remove_field => ["location","local_v