Script access to nested field

Hello Elastic folks,

I need to run a script that gets data from index_a to index_b with some basic ETL.

This works well except I can't figure out the syntax for accessing a nested field like:

"transitions": {
  "properties": {
    "channel": {
      "type": "keyword"
    "created_at": {
      "format": "epoch_millis",
      "type": "date"

My _reindex script looks like this:

if (ctx._source.transitions != null && ctx._source.transitions.created_at != null) {
  ctx._source.transitions.created_at =
    ctx._source.transitions.created_at / 1000000;

…and returns the error

     "script_stack" : [
      "                                                         ^---- HERE"
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "Illegal list shortcut value [created_at]."

It feels like I'm missing something obvious.

Thanks for your help!

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