Filtering nested field

Hi all,

I have read over several docs & examples, but had no success. I am on 2.4.

My nested data is{"name":"XYZ","taglevel":"1"}.

I want elastic search to return name values of taglevel 1. I will then setup the same for taglevel 2, 3 etc.

include will not work, as that only lets me include on the field I am returning.

I have tried countless options such as here. But that returned: nested: SearchParseException[Unexpected token START_OBJECT in [inner].]

Here is my query (which works but does not filter):

  "sort": [{
    "updated": "asc"
  }],
  "_source": ["title"],
  "aggs": {
    "tag.name3": {
      "filter": {},
      "aggs": {
        "inner": {
          "aggs": {
            "tag.name": {
              "terms": {
                "field": "tag.name",
                "size": 50
              }
            },
            "tag.name_count": {
              "cardinality": {
                "field": "tag.name"
              }
            }
          },
          "nested": {
            "path": "tag"
          }
        }
      }
    }
  },
  "highlight": {
    "fields": {
      "title": {}
    }
  },
  "query": {
    "filtered": {
      "filter": {
        "term": {
          "owner.id": "1"
        }
      }
    }
  },
  "size": 100
}

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