Painless list collect

I am trying to do a script transform in painless, and am following an example I found here regarding list.collect syntax.

My painless script is:

      "transform" : {
        "script" : "return ctx.payload.hits.aggs.users_per_month.buckets.collect {it}",
    "lang": "painless"

This is failing at the "}";

What is a painless script that will extract a certain field from each of the results, returning a list?


Those docs are from a previous version of watcher, when groovy scripting was recommended (which cannot just be changed by adding "lang": "painless"). Take a look at the current docs.

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