# How to Find a document with maximum number of fields in ElasticSearch

**URL:** <https://discuss.elastic.co/t/how-to-find-a-document-with-maximum-number-of-fields-in-elasticsearch/289593>\
**Category:** Elasticsearch\
**Created:** [November 18, 2021, 1:19pm UTC](https://discuss.elastic.co/t/how-to-find-a-document-with-maximum-number-of-fields-in-elasticsearch/289593 "2021-11-18T13:19:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amars39](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amars39/32/78248_2.png) [@amars39](https://discuss.elastic.co/u/amars39)\
**Post date:** [November 18, 2021, 1:19pm UTC](https://discuss.elastic.co/t/how-to-find-a-document-with-maximum-number-of-fields-in-elasticsearch/289593/1 "2021-11-18T13:19:25Z")

</div>

Hi, we are trying to find a document in elastic index with maximum number of fields , my document is below format . is there any way to get the document or the highest number of fields count in the document.

{  
"caseId":1233  
"formElements:[{  
"header": 123,  
"extraobjects":{ -\>\> this object can more attributes , can be added dynamically  
"test1":"test",  
"test2":"test"  
"test2":"test"  
}  
}]  
}

---

<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:** [December 16, 2021, 1:19pm UTC](https://discuss.elastic.co/t/how-to-find-a-document-with-maximum-number-of-fields-in-elasticsearch/289593/2 "2021-12-16T13:19:57Z")

</div>

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