# How to query documents contain nested field's element length \> 0

**URL:** <https://discuss.elastic.co/t/how-to-query-documents-contain-nested-fields-element-length-0/18253>\
**Category:** Elasticsearch\
**Created:** [June 23, 2014, 5:49am UTC](https://discuss.elastic.co/t/how-to-query-documents-contain-nested-fields-element-length-0/18253 "2014-06-23T05:49:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hoan\_Nguyen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hoan_nguyen/32/1458_2.png) [@Hoan\_Nguyen](https://discuss.elastic.co/u/Hoan_Nguyen)\
**Post date:** [June 23, 2014, 5:49am UTC](https://discuss.elastic.co/t/how-to-query-documents-contain-nested-fields-element-length-0/18253/1 "2014-06-23T05:49:14Z")

</div>

Hi,

Here is school entity mapping

school:  
mappings:  
name: ~  
rankings:  
type: "nested"  
properties:  
id: ~

I get a problem with query for finding all school contains rankings element  
length \> 0. I try use filter script but it throws error. I don't know how  
to fix it. Pls help me resolve this issue. Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1da1fe9d-0196-4dcd-9342-59d6f46068a0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1da1fe9d-0196-4dcd-9342-59d6f46068a0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:20am UTC](https://discuss.elastic.co/t/how-to-query-documents-contain-nested-fields-element-length-0/18253/2 "2017-07-06T01:20:40Z")

</div>


