Hi Guys,
I have a little problem here and I just really don't know what I'm missing because it's my first time using ruby filter. No result is coming from the output stdout. Hope you can help me.
Here's my only data.
{
"took" : 41,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_index",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "ruby_test"
}
}
]
}
}
My goal is to get request one of our indices. Here's my logstash pipeline I've created.
filter {
ruby {
init => '
uri = URI.parse("
https://username:password@localhost:9200/test_index/_search?q=name=ruby_test&filter_path=hits.hits._source
")
req_options = {
use_ssl:uri.scheme == "https",
}
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
'
}
}
output {
stdout {}
}
Thanks,
Ruru anne