Can't Drill Down to Nested Object

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

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

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