# Поиск по вложенному nested type

**URL:** https://discuss.elastic.co/t/nested-type/322102
**Category:** Вопросы на русском языке
**Created:** [December 28, 2022, 2:13pm UTC](https://discuss.elastic.co/t/nested-type/322102 "2022-12-28T14:13:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![One\_Two](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/one_two/32/77781_2.png) [@One\_Two](https://discuss.elastic.co/u/One_Two)
#### Post date: [December 28, 2022, 2:13pm UTC](https://discuss.elastic.co/t/nested-type/322102/1 "2022-12-28T14:13:40Z")

</div>

Здравствуйте, возможно ли в одном запросе сделать две разные query. Изначально мой запрос выглядел так

```auto
{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": [
        {
          "term": {
            "tag": "new_lead"
          }
        }
      ]
    }
  },
  "size": 10
}

```

Я добавил в индекс nested поле offers, поиск по нему такой

```auto
{
  "query": {
    "nested": {
      "path": "offers",
      "query": {
        "bool": {
          "filter": [
            {
              "term": {
                "offers.status": "selected"
              }
            },
            {
              "term": {
                "offers.amount": "2000000"
              }
            }
          ]
        }
      }
    }
  }
}

```

можно ли эти два запрос объеденить? чтобы искать одновременно и по старым полям и по новым полям nested? Заранее спасибо  
Я пробовал что-то такое, но это не работает

```auto
{
  "query": {
    "bool": {
      "must": [
        {
          "nested": {
            "path": "offers",
            "query": {
              "bool": {
                "filter": [
                  {
                    "term": {
                      "offers.status": "selected"
                    }
                  },
                  {
                    "term": {
                      "offers.amount": "2000000"
                    }
                  }
                ]
              }
            }
          }
        },
        {
          "query": {
            "bool": {
              "filter": [
                {
                  "term": {
                    "tag": {
                      "value": "new_lead"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

```

---

<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 25, 2023, 2:13pm UTC](https://discuss.elastic.co/t/nested-type/322102/2 "2023-01-25T14:13:48Z")

</div>

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