Bucket Aggregation with Distinct Source at multiple levels

Trying to see if I can pull out distinct values (keyword,float) on a bucket level.
Top Hits will give me a lot of values that I have to discard.

{
  "size": 0,
  "query": {
    "bool": {
      "filter": {
        "bool": {
          "must": [
            {
              "range": {
                "week_starting": {
                  "gt": "now-24M/d",
                  "lte": "now/d"
                }
              }
            },
            {
              "terms": {
                "compkey": [
                  "asdasd"
                ]
              }
            }
          ]
        }
      }
    }
  },
  "aggs": {
    "group_by_content": {
      "terms": {
        "field": "destination_city",
        "size": 10000
      },
      --> need to get all the unique values for a field in the aggregation above , do the same thing multiple times<--
      "aggs": {
        "group_by_content": {
          "terms": {
            "field": "origin_city",
            "size": 10000
          }
        }
      }
    }
  }
}

Hoping there is a way to get these via some pathing or sibling type aggregation.

Thanks for the read!

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