# Can't Drill Down to Nested Object

**URL:** <https://discuss.elastic.co/t/cant-drill-down-to-nested-object/75967>\
**Category:** Elasticsearch\
**Created:** [February 21, 2017, 11:12pm UTC](https://discuss.elastic.co/t/cant-drill-down-to-nested-object/75967 "2017-02-21T23:12:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krmathieu](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@krmathieu](https://discuss.elastic.co/u/krmathieu)\
**Post date:** [February 21, 2017, 11:12pm UTC](https://discuss.elastic.co/t/cant-drill-down-to-nested-object/75967/1 "2017-02-21T23:12:59Z")

</div>

I have the query below and it returns the segments.entities.disambiguationResults.attributes.type field in my results:

```
{
  "size": 10,
  "fields": ["document.content", "segments.entities.anchorText", "segments.entities.disambiguationResults.attributes.type"],
    "query": {
        "nested" : {
            "path" : "segments",
            "query" : {
              "bool" : {
              "must": [ 
              {"missing": {"field": "segments.entities.component"}}, 
              {"exists": {"field": "segments.entities.extractionConfidence"}},
              {"exists": {"field": "segments.entities.disambiguationResults.attributes.type"}},
              {"regexp": {"segments.entities.type": "GEO"}}
              ]
              }
            }
        }
    }
}
```

However, if I tack on this condition the query does not throw any errors, it just does not return any results:

{"regexp": {"segments.entities.disambiguationResults.attributes.type": "._[A-Z]._"}}

In the mapping attributes is a nested object under disambiguation results with include\_in\_parent set to true. Any ideas what is going on? Any help would be appreciated. Thanks.

Kevin

---

<div class="post-metadata">

**Author:** ![krmathieu](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@krmathieu](https://discuss.elastic.co/u/krmathieu)\
**Post date:** [February 22, 2017, 6:23pm UTC](https://discuss.elastic.co/t/cant-drill-down-to-nested-object/75967/2 "2017-02-22T18:23:43Z")

</div>

This issue is resolved, I had to use multiple nested queries to drill-down through the nesting to get to what I was looking for. Below is my updated query.

Kevin

```
{
    "size": 10,
    "fields": ["document.content", "segments.entities.anchorText",
    "segments.entities.disambiguationResults.attributes.type"],
    "query": {
        "nested": {
            "path": "segments.entities",
            "query": {
                "nested" : {
                    "path" : "segments.entities.disambiguationResults",
                    "query" : {
                       "match": {
                           "segments.entities.disambiguationResults.attributes.type": "ST"
                        }
                    }
                }
            }
        }
    }
}
```

---

<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:** [March 22, 2017, 6:23pm UTC](https://discuss.elastic.co/t/cant-drill-down-to-nested-object/75967/3 "2017-03-22T18:23:58Z")

</div>

Closed on March 22, 2017, 6:23pm UTC

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