I wanted to transfer some data to a new index. I used a watcher to do it. The thing is, I can't retrieve the values and assign it to its corresponding field. Here's my watcher query
PUT _xpack/watcher/watch/transform
{
"input": {
"search": {
"request": {
"indices": [
"source_index"
],
"body": {
"size": 0,
"aggs": {
"projects": {
"terms": {
"field": "project_number"
},
"aggs": {
"total_sum": {
"sum": {
"field": "amount"
}
},
"accounts": {
"terms": {
"field": "account_id"
}
}
}
}
}
}
}
}
},
"trigger": {
"schedule": {
"interval": "1h"
}
},
"actions": {
"index_payload": {
"transform": {
"script": {
"inline": "return [ '_doc' : ctx.payload.aggregations.projects.buckets.key]; "
}
},
"index": {
"index": "new_index",
"doc_type": "type1"
}
}
}
}
The data are transferred to the index, but also in an aggregated result. I'm wondering if it's possible to separate it's result and assign them to different fields.
Any input is highly appreciated.