node.js - 时尚商务的 Elasticsearch
问题描述
我在弹性搜索中索引了以下数据集
[
{
"id": "1",
"name": "Red T-shirt",
"size": "S",
"styleId": "R-1"
},
{
"id": "2",
"name": "Red T-shirt",
"size": "M",
"styleId": "R-1"
},
{
"id": "3",
"name": "Red T-shirt",
"size": "L",
"styleId": "R-1"
},
{
"id": "4",
"name": "White T-shirt",
"size": "S",
"styleId": "W-1"
},
{
"id": "5",
"name": "White T-shirt",
"size": "XL",
"styleId": "W-1"
}
]
在搜索结果中,我想要按 styleId 分组的产品。是否有可能像下面的示例结果?在亚马逊、Myntra、Flipkart 等大多数商业网站中,我看到他们正在做我正在尝试的事情。我尝试了许多弹性搜索概念,例如“折叠”,但没有成功。使用 kibana 和 elasticsearch 7.4 版。任何建议将不胜感激。
[
{
"id": "1",
"name": "Red T-shirt",
"size": "S",
"styleId": "R-1",
"sizes": [
{
"id": "2",
"name": "Red T-shirt",
"size": "M",
"styleId": "R-1"
},
{
"id": "3",
"name": "Red T-shirt",
"size": "L",
"styleId": "R-1"
}
]
},
{
"id": "4",
"name": "White T-shirt",
"size": "S",
"styleId": "W-1",
"sizes": [
{
"id": "5",
"name": "White T-shirt",
"size": "XL",
"styleId": "W-1"
}
]
},
]
解决方案
推荐阅读
- sql-server - “getDate”可以作为 SQL Server 存储过程名称吗?
- javascript - 将字符串转换为javascript中的对象,如正则表达式
- html - 如何将图片推送到文本下方并在图片旁边写上标题?
- hibernate - Hibernate Envers 禁用 RevisionListener
- kubernetes - 恢复 Rancher 时出错:此集群当前不可用;在 API 准备好之前,与它直接交互的区域将不可用
- php - 一般错误:1364 字段 'kategori_artikel_id' 没有默认值
- html - 如何突出显示角度 6 中的活动选项卡
- php - 搜索 laravel 分页结果
- python - 时间序列的标准差
- angular - 基于 Bootstrap 的电子商务主题未正确集成到 angular8 项目中?