Nested array field in ES

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

{
  "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

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

i dont want to see this output

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