i have indexed 2 tables from mysql to elasticsearch:
user_index:
{
id : 1,
name : user_name,
hobbies : 1,2
}
hobbies_index:
{
id : 1,
name : hobby1
}
id : 2,
name : hobby2
}
i want to enrich my document as users being parent and hobbies being its child using elasticsearch filter plugin for logstash and get the output like this:
{
id : 1,
name : user_name,
hobbies : 1,2
hobbies_name : hobby1, hobby2
}
My config file
input {
elasticsearch {
hosts => "hostname"
index => "user_index*"
query => '{ "query": { "match_all": { } } }'
scroll => "5m"
docinfo => true
}
}
filter {
elasticsearch {
hosts => "hostname"
index => "hobbies_index"
query => "id:%{id}"
fields => { "name" => "hobbies_name" }
}
}
output {
elasticsearch {
hosts => ["hostname"]
index => "test"
}
How do i correctly do this? please help i'm a newbie.