两个独立索引
结构如下
POST /customer_index/_doc/3
{
"name": "John3",
"id_card": "1234567892",
"customer_id": "CUST003",
"age": 25,
"occupation": "IT",
"gender": "Male"
}
POST /transaction_index/_doc/5
{
"id_card": "1234567891",
"transaction_code": "TRX002",
"transaction_time": "2023-11-30T10:15:00",
"transaction_name": "Purchase",
"transaction_details": "Item purchased: ABC123, Amount: $50.00"
}
现在想通过聚合查询,查出,10年为一个阶段,每十年阶段内 客户所关联的 transaction_code 分组 统计,最高的 10个 ,最后结果 例如
10-20,客户人数100,
50人 做 TRX002
40人做 TRxx003 依次这般的 结果