类似于 SQL = is_on_sale AND ( (price >20 AND cat_id iN(1,2)) OR (price >30 AND cat_id iN(3,4)) )
ES里面用这个类似查询相同效果
{
"filters": [
{
"type":"pairs",
"operators":[
{"name":"a3","operator":"must"},
{"name":"a4","operator":"must"}
]
},
{
"type": "",
"field": "is_on_sale",
"values":[1],
"pair": "a4",
"operator": "must"
},
{
"type":"pairs",
"operators":[
{"name":"a1","operator":"should&

本文介绍了如何在 Elasticsearch 中实现类似 SQL 的复杂多级查询,通过示例展示了如何组合不同条件进行精确匹配和范围查询,以达到商品筛选的效果。
最低0.47元/天 解锁文章

1319

被折叠的 条评论
为什么被折叠?



