elasticsearch - Elasticsearch 按匹配过滤文档
问题描述
我有三个索引
- 产品
- 品牌
- 楷模
产品索引结构
product:
properties:
brand:
type: "nested"
properties:
id:
type: integer
name:
type: text
model:
type: "nested"
properties:
id:
type: integer
name:
type: text
model:
types:
model:
properties:
name: ~
brand: ~
模型数据集
[
{
"_index": "app_model",
"_type": "model",
"_id": "14",
"_score": 1.0,
"_source": {
"name": "Saxonia",
"brand": "A. Lange & Söhne"
}
},
{
"_index": "app_model",
"_type": "model",
"_id": "19",
"_score": 1.0,
"_source": {
"name": "LS8",
"brand": "Arman Nicolet"
}
}
]
品牌数据集
[
{
"_index": "app_brand",
"_type": "brand",
"_id": "14",
"_score": 1.0,
"_source": {
"name": "A. Lange & Söhne"
}
},
{
"_index": "app_brand",
"_type": "brand",
"_id": "19",
"_score": 1.0,
"_source": {
"name": "Arman Nicolet"
}
}
]
我需要同时搜索型号和品牌。例如:用户输入查询“A. Lange & Söhne”,然后我们给他以下结果(假设我们已经实现了带有错误搜索的部分):
- A. Lange & Söhne
- A. Lange & Söhne Saxonia ... 但是,当用户输入 A. Lange & Söhne Saxonia 时,我只需要给他以下列表: A. Lange & Söhne Saxonia ... 问题是如何实现这样的向elasticsearch 提出请求,因为我的请求包含错误优化和通过可选匹配对输入文本的音译如果我们发现与模型完全匹配,您如何判断不需要包含A. Lange & Söhne品牌?我们如何在查询中包含误差近似?
解决方案
推荐阅读
- javascript - Bootstrap 4.2.1 - 无法在“文档”上执行“querySelector”:“javascript:void(0);” 不是有效的选择器
- cakephp - Cakephp3:调用的扩展无法识别/配置:html
- mapbox-gl-js - 是否可以为 Mapbox GL 地图设置“最大允许间距”?
- ruby-on-rails - Rails 如何将数据保存到多个表中
- pandas - pandas.read_csv 中是否有与 chunksize 参数等效的 pyarrow?
- alibaba-cloud - 安装在阿里云ECS上的mysql服务器无法重启?
- java - 根据jframe中的条件在特定区域上绘制颜色
- python - 在 Python 上使用 plotly 方法:离线散点法在同一个图中同时比较两个因素
- python - 使用池的 TensorFlow 错误:无法腌制 _thread.RLock 对象
- .net - 如何使用计数在四个表之间获取 Linq 中的数据到 EF 连接?