Elasticseach nested aggregation Elasticseach nested aggregation elasticsearch elasticsearch

Elasticseach nested aggregation


Why don't you do a aggregation swapping the aggregation levels. Firt aggregate on the keywords and then on the polarity -

POST forum_poc/_search?search_type=count{  "aggs": {    "aggregation": {      "nested": {        "path": "Reviews"      },      "aggs": {        "polarity": {          "terms": {            "field": "keyword",            "size": 10          },          "aggs": {            "keyword": {              "terms": {                "field": "polarity",                "size": 10              }            }          }        }      }    }  }}