# Фильтр по nested объектам

**URL:** <https://discuss.elastic.co/t/nested/320579>\
**Category:** Вопросы на русском языке\
**Created:** [December 6, 2022, 12:46pm UTC](https://discuss.elastic.co/t/nested/320579 "2022-12-06T12:46:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexkab](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Alexkab](https://discuss.elastic.co/u/Alexkab)\
**Post date:** [December 6, 2022, 12:46pm UTC](https://discuss.elastic.co/t/nested/320579/1 "2022-12-06T12:46:23Z")

</div>

Добрый день! Подскажите, пожалуйста, как вывести только нужные nested объекты

```auto
PUT test
{
  "mappings": {
    "properties": {
      "title": {
        "type": "text"
      },
      "author": {
        "type": "object",
        "properties": {
          "first": {
            "type": "text"
          },
          "last": {
            "type": "text"
          }
        }
      }
    }
  }
}

PUT test/_doc/1
{
  "title": "В чем разница между nested и object?",
  "author": [{
    "first": "Sanzhar",
    "last": "Kaiyrbek"
  }, {
    "first": "Igor",
    "last": "Motov"
  } ]
}

POST test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "author.first": "Sanzhar"
          }
        },
        {
          "match": {
            "author.last": "Kaiyrbek"
          }
        }
      ]
    }
  }
}

```

Запрос выводит документ со всеми nested объектами.  
Как модифицировать этот запрос, чтобы он выводил документ только с одним определённым nested объектом (например, где "author.first": "Sanzhar")?

---

<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:** [January 3, 2023, 12:47pm UTC](https://discuss.elastic.co/t/nested/320579/2 "2023-01-03T12:47:10Z")

</div>

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