es可不可以实现子聚合的全局排序?
例如:
姓名 性别
tom 男
jack 女
jack 女
tom 女
tom 女
 
正常聚合:
																				例如:
姓名 性别
tom 男
jack 女
jack 女
tom 女
tom 女
正常聚合:
{
	"key": "tom",
	"doc_count": 3,
	"s1": {
		"doc_count_error_upper_bound": 0,
		"sum_other_doc_count": 0,
		"buckets": [
			{
				"key": "女",
				"doc_count": 2
			},
			{
				"key": "男",
				"doc_count": 1
			}
		]
	}
}
,
{
	"key": "jack",
	"doc_count": 2,
	"s1": {
		"doc_count_error_upper_bound": 0,
		"sum_other_doc_count": 0,
		"buckets": [
			{
				"key": "女",
				"doc_count": 2
			}
		]
	}
}期望得到下面结果(即子聚合全局排序){
	"key": "女",
	"doc_count": 2
},
{
	"key": "女",
	"doc_count": 2
},
{
	"key": "男",
	"doc_count": 1
}
			
															
	
2 个回复
doctor
赞同来自:
换成order by gender,name即可实现
zz_hello
赞同来自: