# Does ES has limit of field count when using fields in query?

**URL:** <https://discuss.elastic.co/t/does-es-has-limit-of-field-count-when-using-fields-in-query/25896>\
**Category:** Elasticsearch\
**Created:** [July 20, 2015, 10:48am UTC](https://discuss.elastic.co/t/does-es-has-limit-of-field-count-when-using-fields-in-query/25896 "2015-07-20T10:48:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)\
**Post date:** [July 20, 2015, 10:48am UTC](https://discuss.elastic.co/t/does-es-has-limit-of-field-count-when-using-fields-in-query/25896/1 "2015-07-20T10:48:46Z")

</div>

I use "fields" to return selected fields in response.

If I the fields numbers is small I can get the fields in response correctly, but if there is many fields in "fields", then some fields will be missing in response.

Example, if I put only two fields:  
"fields":["DocumentId","ProductTypeID"]

I can get productTypeID correctly in response. but if I put quite a lot, say 70+ fields, then the productTypeId field is missing in response.

Does ES has limit on the fields count?

---

<div class="post-metadata">

**Author:** ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)\
**Post date:** [July 21, 2015, 4:02am UTC](https://discuss.elastic.co/t/does-es-has-limit-of-field-count-when-using-fields-in-query/25896/2 "2015-07-21T04:02:16Z")

</div>

I found the root cause, the reason why some fields are missing is that, those field name has whitespace in front of them.  
like " ProductTypeID"

I am thinking whether ES should trim the whitespace automatically in fields?

---

<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:** [July 6, 2017, 12:00am UTC](https://discuss.elastic.co/t/does-es-has-limit-of-field-count-when-using-fields-in-query/25896/3 "2017-07-06T00:00:16Z")

</div>


