there are multiple items under an order. The order object is stored in the form of nested, and an order is a piece of data.
order 1-> Commodity A, Commodity B, Commodity C, Commodity D
order 2-> Commodity A, Commodity B, Commodity C, Commodity D.
order n--> Commodity F, Commodity x
Storage format in es:
{
"_index":"testindex",
"_type":"testtype",
"_id":"111",
"_version":5,
"_score":1,
"_source":{
"id":"111",
"orderType":"SO",
"ordersDataFrom":"2018-03-15 10:43:10",
"items":[
{
"skuNo":"13225",
"quantity":10,
"cost":50
},
{
"skuNo":"13230",
"quantity":10,
"cost":22
},
{
"skuNo":"1375",
"quantity":10,
"cost":17
}
]
}
}
query results want to be displayed in the commodity dimension, that is, a product is a piece of data, and paging is supported.
Commodity An order 1
Commodity B order 1
Commodity C order 1
Commodity D order 1Commodity An order 2
Commodity B order 2
Commodity C order 2
Commodity D order 2
.
Commodity F order n
Commodity x order n
I would like to ask all the great gods, how should this query be written?