# Accessing nested objects in a filter script

**URL:** <https://discuss.elastic.co/t/accessing-nested-objects-in-a-filter-script/232511>\
**Category:** Elasticsearch\
**Created:** [May 13, 2020, 8:34pm UTC](https://discuss.elastic.co/t/accessing-nested-objects-in-a-filter-script/232511 "2020-05-13T20:34:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnc1](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@johnc1](https://discuss.elastic.co/u/johnc1)\
**Post date:** [May 13, 2020, 8:34pm UTC](https://discuss.elastic.co/t/accessing-nested-objects-in-a-filter-script/232511/1 "2020-05-13T20:34:59Z")

</div>

Is there a way to access nested objects in a filter script? I found several relevant questions on this forum, but all are without answers. I got a mapping:

```json
    "properties": {
      "locations": {
        "type": "nested",
        "properties": { "kind": { "type": "keyword" } }
      }
    }

```

I tried using `doc['locations.kind']`, but it shows up as empty.

I need this to implement custom filtering based on analyzing the entire set of nested objects for each parent object in a way that cannot be accomplished using builtin elasticsearch filters. If it's not possible to access nested objects in a script, would it be possible from an elasticsearch plugin?

---

<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:** [June 10, 2020, 8:35pm UTC](https://discuss.elastic.co/t/accessing-nested-objects-in-a-filter-script/232511/2 "2020-06-10T20:35:06Z")

</div>

Closed on June 10, 2020, 8:35pm UTC

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