我将在Eleasticsearch中存储产品目录的数据,并在此处描述其简化模型: 产品目录模型
我可以将整个产品存储为一个文档:
{
"productNumber": "123456",
"brand": "Acme Inc.",
"title": "T-Shirt",
"featured": false,
"promo": true,
"categories": [
{ "categoryId": "124", "categoryPath": "/10/123/124", "title": "T-Shirts", "titlePath": "Men's/Summer/T-Shirts" },
{ "categoryId": "666", "categoryPath": "/20/666", "title": "Men's", "titlePath": "Promos / Men's" }
],
"variants": [
{
"sku": "123456-01",
"color": "red",
"size": "XL",
"prices": [
{ "pricelist": "EUR-RRP", "currency": "EUR", "price": 200, "discountPc": 0, "discounted": false },
{ "pricelist": "EUR-PROMO", "currency": "EUR", "price": 180, "discountPc": 10, "discounted": true }
],
"inventories": [
{ "inventoryId": …Run Code Online (Sandbox Code Playgroud)