标准商品聚合


商品聚合(Aggregations)提供分组和统计商品的能力,它允许应用在商品数据上生成复杂的分析统计。标准商品聚合提供品牌(brand)、类目(cats)、扩展属性(props)聚合,扩展属性聚合只有类目路径查询条件到最小子目录时才会生效。
聚合不支持分页和排序,即聚合是针对符合查询条件的所有商品数据.

  1. SKU聚合
  2. SPU聚合

1. SKU聚合

根据查询条件聚合商品SKU信息。

URL HTTP 功能
/aggregations/:adminId GET 返回SKU聚合结果

请求参数

参数名 数据类型 可需 描述
SKU查询请求参数 - - 不支持分页和排序,即聚合是针对符合查询条件的所有商品数据

返回结果

  • 返回结果中"key"字段表示聚合值,"doc_count"字段表示该聚合值的商品数目。
  • "brand"字段表示品牌的聚合值;"cats"表示类目的聚合值,类目是树形结构,"childs"表示子类目;"pros"表示扩展属性的聚合值。

http://192.168.65.222:18082/aggregations/A967550?q=apple&cats=b2c,设备耗材,数码通讯类,电脑/电脑周边

HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET

{
    "brand": [
        {
            "key": "Apple/苹果",
            "doc_count": 1
        },
        {
            "key": "苹果(APPLE)",
            "doc_count": 1
        }
    ],
    "cats": [
        {
            "childs": [
                {
                    "childs": [
                        {
                            "childs": [
                                {
                                    "childs": [],
                                    "key": "电脑/电脑周边",
                                    "doc_count": 2
                                }
                            ],
                            "key": "数码通讯类",
                            "doc_count": 2
                        }
                    ],
                    "key": "设备耗材",
                    "doc_count": 2
                }
            ],
            "key": "b2b",
            "doc_count": 2
        },
        {
            "childs": [
                {
                    "childs": [
                        {
                            "childs": [
                                {
                                    "childs": [],
                                    "key": "电脑/电脑周边",
                                    "doc_count": 2
                                }
                            ],
                            "key": "数码通讯类",
                            "doc_count": 2
                        }
                    ],
                    "key": "设备耗材",
                    "doc_count": 2
                }
            ],
            "key": "b2c",
            "doc_count": 2
        }
    ],
    "props": [
        {
            "childs": [
                {
                    "key": "全高清屏(1920×1080)",
                    "doc_count": 1
                }
            ],
            "key": "分辨率",
            "doc_count": 1
        },
        {
            "childs": [
                {
                    "key": "Intel i5",
                    "doc_count": 1
                }
            ],
            "key": "处理器",
            "doc_count": 1
        },
        {
            "childs": [
                {
                    "key": "10.1-12英寸",
                    "doc_count": 1
                }
            ],
            "key": "尺寸",
            "doc_count": 1
        },
        {
            "childs": [
                {
                    "key": "集成显卡",
                    "doc_count": 1
                }
            ],
            "key": "显卡",
            "doc_count": 1
        }
    ]
}

2. SPU聚合

根据查询条件查询商品SPU信息。

URL HTTP 功能
/spu_aggregations/:adminId GET 返回SPU聚合结果

请求参数

SKU聚合请求参数

返回结果

  • 返回结果中"key"字段表示聚合值,"doc_count"字段表示该聚合值的商品数目。
  • "brand"字段表示品牌的聚合值;"cats"表示类目的聚合值,类目是树形结构,"childs"表示子类目;"pros"表示扩展属性的聚合值。

http://192.168.65.222:18082/spu_aggregations/A967550?q=apple&cats=b2c,设备耗材,数码通讯类,电脑/电脑周边

HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET

{
    "brand": [
        {
            "key": "Apple/苹果",
            "doc_count": 1
        },
        {
            "key": "苹果(APPLE)",
            "doc_count": 1
        }
    ],
    "cats": [
        {
            "childs": [
                {
                    "childs": [
                        {
                            "childs": [
                                {
                                    "childs": [],
                                    "key": "电脑/电脑周边",
                                    "doc_count": 2
                                }
                            ],
                            "key": "数码通讯类",
                            "doc_count": 2
                        }
                    ],
                    "key": "设备耗材",
                    "doc_count": 2
                }
            ],
            "key": "b2b",
            "doc_count": 2
        },
        {
            "childs": [
                {
                    "childs": [
                        {
                            "childs": [
                                {
                                    "childs": [],
                                    "key": "电脑/电脑周边",
                                    "doc_count": 2
                                }
                            ],
                            "key": "数码通讯类",
                            "doc_count": 2
                        }
                    ],
                    "key": "设备耗材",
                    "doc_count": 2
                }
            ],
            "key": "b2c",
            "doc_count": 2
        }
    ],
    "props": [
        {
            "childs": [
                {
                    "key": "全高清屏(1920×1080)",
                    "doc_count": 1
                }
            ],
            "key": "分辨率",
            "doc_count": 1
        },
        {
            "childs": [
                {
                    "key": "Intel i5",
                    "doc_count": 1
                }
            ],
            "key": "处理器",
            "doc_count": 1
        },
        {
            "childs": [
                {
                    "key": "10.1-12英寸",
                    "doc_count": 1
                }
            ],
            "key": "尺寸",
            "doc_count": 1
        },
        {
            "childs": [
                {
                    "key": "集成显卡",
                    "doc_count": 1
                }
            ],
            "key": "显卡",
            "doc_count": 1
        }
    ]
}

results matching ""

    No results matching ""