We have input json objects looks like below
{
"ids": [
{
"id": 1,
"name": "name1"
},
{
"id": 2,
"name": "name2"
}
],
"codes": [
{
"code": "4"
},
{
"code": "2"
}
]
}
{
"ids": [
{
"id": 1,
"name": "name1"
},
{
"id": 2,
"name": "name2"
}
],
"codes": [
{
"code": "1"
},
{
"code": "2"
}
]
}
I want to add a new field and set to "Y" to json object if "name1" exists in "ids" and "4" exists in "codes" else set it to "N".
So i added in filter
if [ids][name] == "name1" and [codes][code] == "4" {
mutate{add_field=>{"new_field":"Y"}}
}else{
mutate{add_field=>{"new_field":"N"}}
}
but it always setting to "N"
Can someone help me out here?