How to get an aggregation separated by type? How to get an aggregation separated by type? elasticsearch elasticsearch

How to get an aggregation separated by type?


It is possible:

{  "size": 0,  "aggs": {    "by_type": {      "terms": {        "field": "_type",        "size": 10      },      "aggs": {        "by_color": {          "terms": {            "field": "color",            "size": 10          }        }      }    }  }}