# How to push nested documents with filebeat to a dynamically create index

**URL:** <https://discuss.elastic.co/t/how-to-push-nested-documents-with-filebeat-to-a-dynamically-create-index/219192>\
**Category:** Elasticsearch\
**Created:** [February 13, 2020, 11:42am UTC](https://discuss.elastic.co/t/how-to-push-nested-documents-with-filebeat-to-a-dynamically-create-index/219192 "2020-02-13T11:42:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baylib](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baylib/32/55463_2.png) [@Baylib](https://discuss.elastic.co/u/Baylib)\
**Post date:** [February 13, 2020, 11:42am UTC](https://discuss.elastic.co/t/how-to-push-nested-documents-with-filebeat-to-a-dynamically-create-index/219192/1 "2020-02-13T11:42:36Z")

</div>

Hi,

I create nested json documents.  
I manage to push them with filebeat to get the mapping done dynamicaly.  
There was some arrays of objects.  
Then reindexed them in new index with the mapping changed for those arrays of objects to nested.

I managed to do nested requests and aggregations so all is fine 🙂

Unfortunatly, when a new index is created automatically the next day by filebeat, the mapping is not nested for new documents but back to arrays of objects. And I have to reindex to get them nested.

I can see that the index pattern shows the nested fields as aggregatable and searchable but I think it's an artefact of the dynamic mapping.

So how to push the new documents with filebeat in new index to get nested mapping done correctly without having to reindex?

And how to remove fields in the index pattern after reindexing arrays of object to nested object?

---

<div class="post-metadata">

**Author:** ![Baylib](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baylib/32/55463_2.png) [@Baylib](https://discuss.elastic.co/u/Baylib)\
**Post date:** [February 14, 2020, 10:31am UTC](https://discuss.elastic.co/t/how-to-push-nested-documents-with-filebeat-to-a-dynamically-create-index/219192/2 "2020-02-14T10:31:57Z")

</div>

Using a template and disabling dynamic mapping did the trick.

---

<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:** [March 13, 2020, 10:32am UTC](https://discuss.elastic.co/t/how-to-push-nested-documents-with-filebeat-to-a-dynamically-create-index/219192/3 "2020-03-13T10:32:01Z")

</div>

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