How do i sort before order with cardinalit aggs

Hi experts
I have my query

{
	"query": {"term": { "content_level": "A" }}, 
	"aggs": {
		"author": {
			"terms": {"field": "author_name",
					"order": { "count.value" : "desc" },
					"size" : 10},
			"aggs": {
				"count": {
					"cardinality": {"field": "news_id"}
				}
			}
		}
	}
}

The buckets result seem ok but my problem is if the Author dont have content_level A, i cant show this author. So i want to update my query with sort by content_level desc then do the cardinality aggresstion. How can i do it. I have try many ways but my buckets still get wrong result.
Thanks

Anyone can help me solve this
Thanks

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