# Querying a list to check the size

**URL:** <https://discuss.elastic.co/t/querying-a-list-to-check-the-size/284969>\
**Category:** Kibana\
**Tags:** painless, kql-kibana-query-language\
**Created:** [September 23, 2021, 8:01am UTC](https://discuss.elastic.co/t/querying-a-list-to-check-the-size/284969 "2021-09-23T08:01:18Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [September 27, 2021, 5:32pm UTC](https://discuss.elastic.co/t/querying-a-list-to-check-the-size/284969/4 "2021-09-27T17:32:35Z")

</div>

Initially, I wondered: are there multiple indices matched in the search, which might include older indices that do not have the correct mapping?

After doing more research, I noticed a few things that apply here:

1. The documentation lists the ways to interact with `nested` documents, and it doesn't mention they can be interacted with in a script: [https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-accessing-documents](https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html#nested-accessing-documents)
2. The documentation states that nested objects are stored as separate documents, but the script query works on single documents at a time
3. I found [another post with a similar question](https://discuss.elastic.co/t/help-for-painless-iterate-nested-fields/162394), and the responder stated:

> You can not access the values of all nested objects in a script at query time. Your script query only works on one nested object at a time.

---

_[View the full topic](https://discuss.elastic.co/t/querying-a-list-to-check-the-size/284969)._
