# How to cope with huge nested fields?

**URL:** <https://discuss.elastic.co/t/how-to-cope-with-huge-nested-fields/152093>\
**Category:** Elasticsearch\
**Created:** [October 11, 2018, 4:08pm UTC](https://discuss.elastic.co/t/how-to-cope-with-huge-nested-fields/152093 "2018-10-11T16:08:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Milkana\_Stateva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/milkana_stateva/32/36420_2.png) [@Milkana\_Stateva](https://discuss.elastic.co/u/Milkana_Stateva)\
**Post date:** [October 11, 2018, 4:08pm UTC](https://discuss.elastic.co/t/how-to-cope-with-huge-nested-fields/152093/1 "2018-10-11T16:08:32Z")

</div>

Hi all,  
We have es 6.x with mapping of nested fields with various values and sizes. Some of the fields contain up to 1M short string values. The user should be able to filter and perform aggregations on them in reasonable time (ms).  
We want to optimize the queries against this fields, by splitting them to smaller chunks, and we want to know which is better.  
the field mapping is : {  
myField:{  
type: nested,  
properties: {  
id: keyword  
values: [  
text,  
fields: {  
keyword  
}  
]  
}}}

option 1:  
Split the fields by limited "values" size  
Instead of one doc with 1M values we can insert 10 docs with 100K values each  
option 2:  
use an array of nested objects, so each chunk gets its own document

Thanks,  
Nirit and Milkana

---

<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:** [November 8, 2018, 4:08pm UTC](https://discuss.elastic.co/t/how-to-cope-with-huge-nested-fields/152093/2 "2018-11-08T16:08:32Z")

</div>

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