I am trying to do an aggregation on values in an array and also filter the buckets that are returned by a prefix. Not sure if this is possible or I am misusing the filter b
Try this, it will filter the values the buckets themselves are created for:
{ "size": 0, "aggs": { "colors": { "filter": { "prefix": { "colors": "b" } }, "aggs": { "top-colors": { "terms": { "field": "colors", "include": { "pattern": "b.*" } } } } } } }