# Correct way to access nested fields in logstash filters

**URL:** https://discuss.elastic.co/t/correct-way-to-access-nested-fields-in-logstash-filters/133005
**Category:** Logstash
**Created:** [May 23, 2018, 2:31pm UTC](https://discuss.elastic.co/t/correct-way-to-access-nested-fields-in-logstash-filters/133005 "2018-05-23T14:31:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [May 23, 2018, 2:31pm UTC](https://discuss.elastic.co/t/correct-way-to-access-nested-fields-in-logstash-filters/133005/1 "2018-05-23T14:31:09Z")

</div>

Hello,

The documentation says that to access nested fields you need to use the format `[parent][child]`, but the format `[parent.child]` also works.

I started to use `[parent.child]` after some tests on version `5.4` where, for some reason maybe not related to the field name, the format `[parent][child]` was not working.

Now I have a few fields and filters where I use `[parent.child]` without any problem.

My question is: Should I change it to `[parent][child]` or could I keep using `[parent.child]`, which looks better in my opinion

A example of my use is:

```auto
    if [device.model] == "MODEL" {
        translate {
                field => "rule.policy"
                destination => "rule.policy"
                override => true
                dictionary_path => ["/etc/logstash/dict/dict-rules.yml"]
                refresh_interval => "900"
        }
    }

```

If I change it to `[parent][child]` as show bellow, it will work without any problem?

```auto
    if [device][model] == "MODEL" {
        translate {
                field => "[rule][policy]"
                destination => "[rule][policy]"
                override => true
                dictionary_path => ["/etc/logstash/dict/dict-rules.yml"]
                refresh_interval => "900"
        }
    }

```

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [May 23, 2018, 3:57pm UTC](https://discuss.elastic.co/t/correct-way-to-access-nested-fields-in-logstash-filters/133005/2 "2018-05-23T15:57:01Z")

</div>

Oh, I've just made a confusion.

The fields aren't really nested, they are objects, that's why the [parent][child] did not worked when I tried, the field name was parent.child.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 23, 2018, 4:06pm UTC](https://discuss.elastic.co/t/correct-way-to-access-nested-fields-in-logstash-filters/133005/3 "2018-05-23T16:06:42Z")

</div>

> [@leandrojmp](#):
>
> the field name was parent.child

Having . in a field name works, except where it does not work (and there are definitely places where it doesn't). I believe it is unsupported.

---

<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 20, 2018, 4:06pm UTC](https://discuss.elastic.co/t/correct-way-to-access-nested-fields-in-logstash-filters/133005/4 "2018-06-20T16:06:45Z")

</div>

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