我有以下映射
PUT prod_nested
{
"mappings": {
"default": {
"properties": {
"pkey": {
"type": "keyword"
},
"original_price": {
"type": "float"
},
"tags": {
"type": "nested",
"properties": {
"category": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 30
}
}
},
"attribute": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 30
}
}
},
"original_price": {
"type": "float"
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试做类似以下 sql 聚合的事情
select tag_attribute,
tag_category,
avg(original_price)
FROM products
GROUP BY tag_category, tag_attribute …Run Code Online (Sandbox Code Playgroud)