# How to add dynamic fields + index with a logstash filter?

**URL:** <https://discuss.elastic.co/t/how-to-add-dynamic-fields-index-with-a-logstash-filter/70964>\
**Category:** Elasticsearch\
**Created:** [January 9, 2017, 4:03pm UTC](https://discuss.elastic.co/t/how-to-add-dynamic-fields-index-with-a-logstash-filter/70964 "2017-01-09T16:03:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thokari](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@thokari](https://discuss.elastic.co/u/thokari)\
**Post date:** [January 9, 2017, 4:03pm UTC](https://discuss.elastic.co/t/how-to-add-dynamic-fields-index-with-a-logstash-filter/70964/1 "2017-01-09T16:03:31Z")

</div>

Hi,  
new to ELK. I have some Docker logs that I am successfully sending to Kibana.  
However next to the field names that I am creating in that filter, it shows a '?', which means 'field not indexed'

This is my filter  
`filter { if [type] == "docker_log" { json { source => "message" add_field => ["received_at", "%{@timestamp}"] add_field => ["received_from", "%{host}"] } mutate { rename => { "log" => "message" } } date { match => ["time", "ISO8601"] } } }`

How can I

1. Make it so that the fields are indexed?
2. Add dynamically every field in the JSON documents, of which I don't know the values yet? I thought this was the point in the first place of having logs in JSON...

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 13, 2017, 3:05am UTC](https://discuss.elastic.co/t/how-to-add-dynamic-fields-index-with-a-logstash-filter/70964/2 "2017-01-13T03:05:32Z")

</div>

What does the mapping look like for the index?

---

<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:** [February 10, 2017, 3:05am UTC](https://discuss.elastic.co/t/how-to-add-dynamic-fields-index-with-a-logstash-filter/70964/3 "2017-02-10T03:05:39Z")

</div>

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