# Dissect Filter, Creating Subfields

**URL:** https://discuss.elastic.co/t/dissect-filter-creating-subfields/305170
**Category:** Logstash
**Created:** [May 19, 2022, 10:42am UTC](https://discuss.elastic.co/t/dissect-filter-creating-subfields/305170 "2022-05-19T10:42:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shinobu](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@shinobu](https://discuss.elastic.co/u/shinobu)
#### Post date: [May 19, 2022, 10:42am UTC](https://discuss.elastic.co/t/dissect-filter-creating-subfields/305170/1 "2022-05-19T10:42:32Z")

</div>

Hello,

how can i get dissect to create a structure with subfields?

```auto
        dissect {
            mapping => {
                "message" => "%{test.subfield}.%{test.subfield2}"
            }
        }

```

I would expect so get some output like:

```auto
test => {
"subfield" => "somevalue",
"subfield2" => "anothervalue"
}

```

I tried test.subfield, because grok accpets it this way, but it appears to be different in dissect.  
The actual output looks like

```auto
"test.subfield" => "somevalue",
"test.subfield2" => "anothervalue"

```

I hope you can help me out.

---

<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 19, 2022, 11:59am UTC](https://discuss.elastic.co/t/dissect-filter-creating-subfields/305170/2 "2022-05-19T11:59:04Z")

</div>

The way to reference nested fields in logstash is using the `[top-level][sub-level]` format, both in `grok` and `dissect` and in any other filter in logstash.

So to have a field named `test` with the fields `subfield` and `subfield2` nested under it, you should use `[test][subfield]` and `[test][subfield2]`.

So, change your dissect to this:

```auto
"message" => "%{[test][subfield]}.%{[test][subfield2]}"

```

---

<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 16, 2022, 11:59am UTC](https://discuss.elastic.co/t/dissect-filter-creating-subfields/305170/3 "2022-06-16T11:59:25Z")

</div>

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