# Select documents with nested collection without something

**URL:** <https://discuss.elastic.co/t/select-documents-with-nested-collection-without-something/294714>\
**Category:** Elasticsearch\
**Created:** [January 18, 2022, 4:22pm UTC](https://discuss.elastic.co/t/select-documents-with-nested-collection-without-something/294714 "2022-01-18T16:22:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Popov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivan_popov/32/100486_2.png) [@Ivan\_Popov](https://discuss.elastic.co/u/Ivan_Popov)\
**Post date:** [January 18, 2022, 4:22pm UTC](https://discuss.elastic.co/t/select-documents-with-nested-collection-without-something/294714/1 "2022-01-18T16:22:38Z")

</div>

Here is my test data

```auto
[
  {
    "id": 1,
    "last_email_sent": [
      {
        "letterId": 1,
        "timestamp": 555
      },
      {
        "letterId": 2,
        "timestamp": 666
      }
    ]
  },
  {
    "id": 2,
    "last_email_sent": [
      {
        "letterId": 2,
        "timestamp": 777
      }
    ]
  },
  {
    "id": 3,
    "last_email_sent": [
    ]
  }
]

```

Can't understand is it possible to select all documents with letter id=2 and timestamp \> 554 OR have no objects in nested collection with letterId = 1. Regarding to my data - all three documents must be returned.

---

<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:** [February 15, 2022, 4:22pm UTC](https://discuss.elastic.co/t/select-documents-with-nested-collection-without-something/294714/2 "2022-02-15T16:22:44Z")

</div>

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