Reputation: 109
I am trying to upload a kaggle movie dataset using logstash into elasticsearch. The genres field is a stringified JSON object:
"genres" : "[{'id': 28, 'name': 'Action'}, {'id': 18, 'name': 'Drama'}, {'id': 9648, 'name': 'Mystery'}, {'id': 53, 'name': 'Thriller'}]"
Is it possible to transform the value from the above to an array like so using logstash?
"genres"; ["Action", "Drama", "Mystery", "Thriller"]
I tried using the json filter, but no luck.
filter {
json {
source => "genres"
}
}
Upvotes: 1
Views: 182
Reputation: 11
I think you should convert json string to object, then handle this object to new object and convert new object to new json string.
Object: Gener { int id; string value; }
Old Object: { List<Gener> geners }
New Object: { List<string> geners }
Upvotes: 1