I have a watcher that performs a transform on matched records and then posts the result into a different index. I am making use of "ctx.payload._doc" to insert into the index. Depending on a complex action in the transform there is the potential to have an empty _doc list come back out. I'm not sure how to write the action condition to stop it trying to index nothing as it seems to "fail" on receiving the empty set.
Is it possibly to create a "total" field via a transform to perform the conditional against or would that interfere with the index actions mechanism to autoindex the list?
"condition":{
"compare":{
"ctx.payload.hits.total":{
"gt":0
}
}
},
"transform":{
"script":{
"inline":"return ['_doc': []]",
"lang": "painless"
}
},
"actions":{
"condition": {
??????
}
},
"index_payload":{
"index":{
"index":"hazelcast",
"doc_type":"hazelcast"
}
}
}