I have two mysql tables that I want to save into a single Elastic index.
Table 1: Product has id, name ... etc.
Table 2: ProductWarehouse has productId, warehouseId, qtyAvailable ... etc
Product one-to-many ProductWarehouse
My question is, how can I save ProductWarehouse records for each product as an array?
If ProductWarehouse was modified, how to reflect that on the Elastic index?
What is the best practice?
the Product index in Elastic should look like:
{
"id",
"name": ...,
"warehouses": [
{"warehouseId": 1, "qtyAvailable": 3},
{"warehouseId": 10, "qtyAvailable": 30}
]
}