# How to access nested property at script\_fields on elastic 5.x

**URL:** <https://discuss.elastic.co/t/how-to-access-nested-property-at-script-fields-on-elastic-5-x/69855>\
**Category:** Elasticsearch\
**Created:** [December 22, 2016, 11:12pm UTC](https://discuss.elastic.co/t/how-to-access-nested-property-at-script-fields-on-elastic-5-x/69855 "2016-12-22T23:12:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitgandtter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bitgandtter/32/14101_2.png) [@bitgandtter](https://discuss.elastic.co/u/bitgandtter)\
**Post date:** [December 22, 2016, 11:12pm UTC](https://discuss.elastic.co/t/how-to-access-nested-property-at-script-fields-on-elastic-5-x/69855/1 "2016-12-22T23:12:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 19, 2017, 11:12pm UTC](https://discuss.elastic.co/t/how-to-access-nested-property-at-script-fields-on-elastic-5-x/69855/2 "2017-01-19T23:12:44Z")

</div>

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