如何使用Logstash将JSON文件放入弹性搜索

时间:2019-06-14 15:30:11

标签: json elasticsearch logstash

我目前正在尝试使用Logstash将json文件放入弹性搜索。我不确定自己是否做得正确,也不确定如何检查弹性搜索实例以确保自己做得正确。

这是我的配置文件和JSON

input{
 file{
        path => "/Users/CFP668/Downloads/gs-accessing-data-mysql-master/complete/example.json"
        codec => json
        start_position => "beginning"
 }
}

filter{
    json{
        source => "message"
    }
}

output{
    elasticsearch{
        hosts => "localhost:9200"
        index => "test"
    }
    stdout { codec => rubydebug }
}
{"name":"Jonathan","score":"9.9","address":"New Delhi"}
{"name":"Sam","score":"8.9","address":"New York"}
{"name":"Michelle","score":"9.0","address":"California"}

0 个答案:

没有答案