一个最近的开发需求,导出某ES索引上某嵌套字段值
promotion_details.promotion_name
符合以“官方立减”文字结尾的所有数据导出,因为es索引的结构的关系,目前es索引结构的原因,数据需要处理下之后再导出,目前es索引数据的结构大致如下
{
"_index": "my_elasticsearch_index",
"_type": "order",
"_id": "3602478673110456764",
"_version": 1699331966001,
"found": true,
"_source": {
"adjust_fee": "0.00",
"alipay_point": "0",
"available_confirm_fee": "0.00",
"buyer_alipay_no": "****",
......
"oms_orders": [
{
"cart_item_no": "3602478673111456764",
"order_item_id": "210100024285392788",
......
},
......
],
"promotion_details": [
{
"promotion_name": "2023天猫双11抢先购官方立减",
......
},
],
"sub_orders": [
{
"oid": "3602478673111456764",
......
},
......
],
"tid": "3602478673110456764",
"trade_from": "WAP,WAP",
"type": "fixed",
......
}
}
tid为主订单单号、sub_orders.oid为子单单号、oms_orders.cart_item_no对应等于sub_orders.oid,有一条oid子单记录就对应有一条cart_item_no记录。
Continue reading