In my watcher rule, i have implemented a looping for the items from the result as
"body": "{"Type":"MemoryUsage","MidThreshold":90,"MaxThreshold":98,"ServerDetails":[{{[#ctx](javascript:void(0);).payload.aggregations.allservers.buckets}}{"ServerName":"{{key}}","Datatype":"{{latest.hits.hits.0._source.DataType}}","NodeCategory":"{{latest.hits.hits.0._source.node_category}}","NodeType":"{{latest.hits.hits.0._source.node_type}}","NodeLocation":"{{latest.hits.hits.0._source.node_location}}","NodeIsActive":"{{latest.hits.hits.0._source.node_isactive}}","NodePageRange":"{{latest.hits.hits.0._source.node_pagerange}}","Value":{{latest.hits.hits.0._source.PercentUsedMemory}},"OtherInfo":"{{latest.hits.hits.0._source.Drive}}"},{{/ctx.payload.aggregations.allservers.buckets}}]}",
Few of my documents will not have the property {{latest.hits.hits.0._source.node_isactive}} and for those documents currently my json property contains empty value (NodeIsActive :""). What i need is a conditional based property addition to json. Only if the document contains the property latest.hits.hits.0._source.node_isactive, i should assign it to JSON property else the property NodeIsActive should not be available in the json.