Use index action to write to multiple indices

I have following action in my watcher:

  "actions": {
    "writetoindex": {
      "transform": {
        "script": {
          "id": "my_tranform_script",
          }
        }
      "index": {
        "index": "myindex1",
        "doc_type": "_doc",
        "op_type": "CREATE"
      }
    },

The script create a document an write it to an Index. I would like for this action to write to two separate indices at the same time (let say myindex1 and myindex2). Is that possible?

yes, just create a whole new actions clause so that you have two:

  "actions": {
    "writetoindex1": {
      "transform": {
        "script": {
          "id": "my_tranform_script"
        }
      },
      "index": {
        "index": "myindex1",
        "doc_type": "_doc",
        "op_type": "CREATE"
      }
    },
    "writetoindex2": {
      "transform": {
        "script": {
          "id": "my_tranform_script"
        }
      },
      "index": {
        "index": "myindex2",
        "doc_type": "_doc",
        "op_type": "CREATE"
      }
    }
...

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.