# Return only the data inside nested property

**URL:** <https://discuss.elastic.co/t/return-only-the-data-inside-nested-property/126638>\
**Category:** Elasticsearch\
**Created:** [April 3, 2018, 8:51pm UTC](https://discuss.elastic.co/t/return-only-the-data-inside-nested-property/126638 "2018-04-03T20:51:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomTom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomtom/32/3676_2.png) [@TomTom](https://discuss.elastic.co/u/TomTom)\
**Post date:** [April 3, 2018, 8:51pm UTC](https://discuss.elastic.co/t/return-only-the-data-inside-nested-property/126638/1 "2018-04-03T20:51:57Z")

</div>

Currently i have this mapping.

```
{
  "blogs": {
    "mappings": {
      "blog": {
        "properties": {
          "comments": {
            "properties": {
              "content": {
                "type": "nested",
                "properties": {
                  "date": {
                    "type": "date"
                  },
                  "id": {
                    "type": "long"
                  },
                  "message": {
                    "type": "text"
                  },
                  "rating": {
                    "type": "long"
                  }
                }
              }
            }
          },
          "id": {
            "type": "long"
          },
          "tags": {
            "properties": {
              "content": {
                "type": "nested",
                "properties": {
                  "tag": {
                    "type": "text",
                    "fields": {
                      "keyword": {
                        "type": "keyword",
                        "ignore_above": 256
                      }
                    }
                  }
                }
              }
            }
          },
          "title": {
            "type": "text"
          }
        }
      }
    }
  }
}

```

Is possible just return the entries in nested property 'comments' when the blog.id (_father_) is greater than 10 and **comments.content.rating** (_nested_) is equal to 5 and return the 'father' of 'comments' and use sum aggregation for the property **comments.content.rating** (with the equivalent search condition)?

---

<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:** [May 1, 2018, 8:52pm UTC](https://discuss.elastic.co/t/return-only-the-data-inside-nested-property/126638/2 "2018-05-01T20:52:17Z")

</div>

Closed on May 1, 2018, 8:52pm UTC

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