Commit f1505d1b9bb1d5b5756399815da376fadad7c5b9

Authored by tangwang
1 parent dd48ee67

up

Showing 1 changed file with 171 additions and 50 deletions   Show diff stats
docs/MySQL到ES字段映射说明-业务版.md
... ... @@ -410,58 +410,179 @@ WHERE deleted = 0 AND category_id IS NOT NULL
410 410 ## 8. ES 文档示例
411 411  
412 412 ```json
  413 +GET /search_products/_search
413 414 {
414   - "tenant_id": "1",
415   - "spu_id": "12345",
416   - "title_zh": "iPhone 15 Pro Max",
417   - "title_en": "iPhone 15 Pro Max",
418   - "brief_zh": "最新款 iPhone",
419   - "brief_en": "Latest iPhone",
420   - "description_zh": "详细描述...",
421   - "description_en": "Detailed description...",
422   - "vendor_zh": "Apple",
423   - "vendor_en": "Apple",
424   - "tags": ["手机", "智能手机", "Apple"],
425   - "category_path_zh": "电子产品/手机/iPhone",
426   - "category1_name": "电子产品",
427   - "category2_name": "手机",
428   - "category3_name": "iPhone",
429   - "category_id": "3",
430   - "category_level": 3,
431   - "option1_name": "颜色",
432   - "option2_name": "存储容量",
433   - "option1_values": ["深空黑色", "原色钛金属", "白色钛金属"],
434   - "option2_values": ["256GB", "512GB", "1TB"],
435   - "image_url": "https://example.com/image.jpg",
436   - "sales": 1000,
437   - "min_price": 8999.0,
438   - "max_price": 12999.0,
439   - "compare_at_price": 12999.0,
440   - "sku_prices": [8999.0, 10999.0, 12999.0],
441   - "sku_weights": [221, 221, 221],
442   - "sku_weight_units": ["g"],
443   - "total_inventory": 500,
444   - "create_time": "2024-01-01T00:00:00",
445   - "update_time": "2024-01-15T10:30:00",
446   - "title_embedding": [0.123, 0.456, ...],
447   - "skus": [
448   - {
449   - "sku_id": "1001",
450   - "price": 8999.0,
451   - "compare_at_price": 9999.0,
452   - "sku_code": "IP15PM-256-BLK",
453   - "stock": 100,
454   - "weight": 221.0,
455   - "weight_unit": "g",
456   - "option1_value": "深空黑色",
457   - "option2_value": "256GB",
458   - "image_src": "https://example.com/sku1.jpg"
  415 + "size": 1,
  416 + "_source": "*",
  417 + "query": {
  418 + "bool": {
  419 + "filter": [
  420 + { "term": {"_id" : 74174} },
  421 + { "term": { "tenant_id": "162" } }
  422 + ]
  423 + }
459 424 }
460   - ],
461   - "specifications": [
462   - {"sku_id": "1001", "name": "颜色", "value": "深空黑色"},
463   - {"sku_id": "1001", "name": "存储容量", "value": "256GB"}
464   - ]
  425 + }
  426 +```
  427 +
  428 +结果
  429 +
  430 +```json
  431 +{
  432 + "took": 1,
  433 + "timed_out": false,
  434 + "_shards": {
  435 + "total": 1,
  436 + "successful": 1,
  437 + "skipped": 0,
  438 + "failed": 0
  439 + },
  440 + "hits": {
  441 + "total": {
  442 + "value": 1,
  443 + "relation": "eq"
  444 + },
  445 + "max_score": 0,
  446 + "hits": [
  447 + {
  448 + "_index": "search_products",
  449 + "_id": "74174",
  450 + "_score": 0,
  451 + "_source": {
  452 + "tenant_id": "162",
  453 + "spu_id": "74174",
  454 + "title_zh": "实色二阶碳纤维魔方 方形 2阶 塑料【英文包装】",
  455 + "title_en": "Solid Color 2nd Order Carbon Fiber Rubik's Cube Square 2 Steps Plastic [English Packaging",
  456 + "brief_zh": "实色二阶碳纤维魔方 方形 2阶 塑料【英文包装】",
  457 + "brief_en": "Solid Color 2nd Order Carbon Fiber Rubik's Cube Square 2 Steps Plastic [English Packaging",
  458 + "description_zh": "<p>实色二阶碳纤维魔方 方形 2阶 塑料【英文包装】</p>",
  459 + "description_en": "<p>Solid Color 2nd Order Carbon Fiber Rubik's Cube Square 2 Steps Plastic [English Packaging]</p",
  460 + "vendor_zh": "顺达",
  461 + "vendor_en": "Shunda",
  462 + "title_embedding": [
  463 + -0.005125104915350676,
  464 +...
  465 + 0.018752742558717728
  466 + ],
  467 + "tags": [
  468 + "魔方",
  469 + "ShunDa"
  470 + ],
  471 + "category_path_zh": "玩具/汽车",
  472 + "category_path_en": null,
  473 + "category1_name": "玩具",
  474 + "category2_name": "汽车",
  475 + "category_name_zh": "汽车",
  476 + "category_name_en": null,
  477 + "category_name": "汽车",
  478 + "category_id": "593389466647880832",
  479 + "category_level": 2,
  480 + "option1_name": "color",
  481 + "option2_name": "size",
  482 + "option3_name": "material",
  483 + "image_url": "////img.staticdj.com/6eb4a98e2cb23af523da5456e424fc24.jpeg",
  484 + "sales": 0,
  485 + "skus": [
  486 + {
  487 + "sku_id": "3577878",
  488 + "price": 346.13,
  489 + "compare_at_price": 464.3,
  490 + "sku_code": "2210777-Orange-30-塑料英文包装",
  491 + "stock": 87,
  492 + "weight": 1.99,
  493 + "weight_unit": "kg",
  494 + "option1_value": "Orange",
  495 + "option2_value": "30",
  496 + "option3_value": "塑料英文包装"
  497 + },
  498 + {
  499 + "sku_id": "3577879",
  500 + "price": 316.62,
  501 + "compare_at_price": 466.27,
  502 + "sku_code": "2210777-Orange-8-塑料英文包装",
  503 + "stock": 41,
  504 + "weight": 1.95,
  505 + "weight_unit": "kg",
  506 + "option1_value": "Orange",
  507 + "option2_value": "8",
  508 + "option3_value": "塑料英文包装"
  509 + },
  510 +...
  511 + {
  512 + "sku_id": "3577941",
  513 + "price": 380.03,
  514 + "compare_at_price": 553.67,
  515 + "sku_code": "2210777-Olive-2-塑料英文包装",
  516 + "stock": 56,
  517 + "weight": 2.78,
  518 + "weight_unit": "kg",
  519 + "option1_value": "Olive",
  520 + "option2_value": "2",
  521 + "option3_value": "塑料英文包装"
  522 + }
  523 + ],
  524 + "specifications": [
  525 + {
  526 + "sku_id": "3577878",
  527 + "name": "color",
  528 + "value": "Orange"
  529 + },
  530 +...
  531 + {
  532 + "sku_id": "3577941",
  533 + "name": "material",
  534 + "value": "塑料英文包装"
  535 + }
  536 + ],
  537 + "option1_values": [
  538 + "White",
  539 + "Gold",
  540 + "Violet",
  541 + "Olive",
  542 + "Turquoise",
  543 + "Khaki",
  544 + "Teal",
  545 + "Orange"
  546 + ],
  547 + "option2_values": [
  548 + "2",
  549 + "30",
  550 + "8",
  551 + "1",
  552 + "18",
  553 + "27",
  554 + "25",
  555 + "29"
  556 + ],
  557 + "option3_values": [
  558 + "塑料英文包装"
  559 + ],
  560 + "min_price": 262.92,
  561 + "max_price": 389.18,
  562 + "compare_at_price": 567.6,
  563 + "sku_prices": [
  564 + 346.13,
  565 +...
  566 + 309.64,
  567 + 380.03
  568 + ],
  569 + "sku_weights": [
  570 + 1,
  571 + 1,
  572 +...
  573 + 2,
  574 + 2
  575 + ],
  576 + "sku_weight_units": [
  577 + "kg"
  578 + ],
  579 + "total_inventory": 3269,
  580 + "create_time": "2025-11-29T00:02:00",
  581 + "update_time": "2025-12-20T00:01:41"
  582 + }
  583 + }
  584 + ]
  585 + }
465 586 }
466 587 ```
467 588  
... ...