# Nested array field in ES

**URL:** <https://discuss.elastic.co/t/nested-array-field-in-es/321745>\
**Category:** Elasticsearch\
**Created:** [December 21, 2022, 10:04am UTC](https://discuss.elastic.co/t/nested-array-field-in-es/321745 "2022-12-21T10:04:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali5](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ali5/32/113900_2.png) [@Ali5](https://discuss.elastic.co/u/Ali5)\
**Post date:** [December 21, 2022, 10:04am UTC](https://discuss.elastic.co/t/nested-array-field-in-es/321745/1 "2022-12-21T10:04:48Z")

</div>

```auto
GET feeds/_search
{
  
  "query": {
    "nested": {
      "path": "comment",
      "query": {
        "multi_match": {
          "query": "ali",
          "fields": ["body","title","comment.c_text"]
        }
      }
    }
  }

```

this is my querry that is showing me the result given bellow

```auto
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 0.8025915,
    "hits" : [
      {
        "_index" : "feeds",
        "_type" : "_doc",
        "_id" : "NeoTNIUB1Qg_7rFp-8RV",
        "_score" : 0.8025915,
        "_source" : {
          "feed_id" : "1",
          "title" : "Mateen",
          "body" : "This is mateen",
          "comment" : [
            {
              "c_id" : "11",
              "feed_id" : "1",
              "c_text" : "get well soon mateen"
            },
            {
              "c_id" : "12",
              "feed_id" : "1",
              "c_text" : " Ali here"
            }
          ]
        }
      }
    ]
  }
}

```

i want to see the outer hits and dont want to see the content of array that doesnot have "ali" in it but it showing me the array 1 how to hide it

```auto
{
              "c_id" : "11",
              "feed_id" : "1",
              "c_text" : "get well soon mateen"
            },

```

i dont want to see this output

---

<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 18, 2023, 10:04am UTC](https://discuss.elastic.co/t/nested-array-field-in-es/321745/2 "2023-01-18T10:04:56Z")

</div>

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