How to access nested property at script_fields on elastic 5.x

I need to iterate over nested objects on painless script_fields for my query but notation doc['nestedProperty.property'] does not gave me the value, neither does using array notation doc['nestedProperty.property'][0]

A document example:

{
    "neestedProperty": [
      {
        "property": 12,
        "innerNeestedProperty": {
          "innerProperty1": 45,
          "innerProperty2": -45
        }
      }
    ]
}

example query:

{
  "query": {
    match_all: {}
  },
  "script_fields": {
    "scripted": {
      "script": {
        "inline": "doc['neestedProperty.property'] * params.multiplier",
        "params": {
          "multiplier": 100
        },
        "lang": "painless"
      }
    }
  }
}

Any idea on how to use this? Thanks

1 Like

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