I am retrieving some json data from a REST API ussing the http_poller input pluging :
http_poller {
urls => {
"myurl" => "https://myAPI"
}
interval => 30
type => "myType"
add_field => {
"tag" => "myTag"
}
}
This returns a json formatted data :
{"data_from_cache": false, "logs": [{"protocol": "PESIT", "processed": false }]}
I need this data to be indexed in elasticsearch and I already prepared a mapping :
{
"my_mapping" : {
"properties" : {
"protocol" : { "type": "string" },
"processed" : { "type": "boolean" },
"tag" : { "type" : "String" }
}
}
}
The data is not wrapped like the mapping. This configuration put the data like the following in elasticsearch :
data_from_cache: "false"
logs: "{ "protocol": "PESIT", "processed": false} "
I need the fields "protocol" and "processed" to be mapped as mentioned in separate fields. I do not need the data_from_cache field, I just need the data within logs in separate fields. How can I do that ? Should I use a json filter or a json codec ?