elasticsearch - elasticsearch(6.0.1)中是否有替代方法代替嵌套类型
问题描述
我们在我的索引中嵌套了类型映射,一个索引中有大约 400 万个文档。下面是带有示例的映射。使用 Elasticsearch 6.0.1
"mappings": {
"inventory": {
"name" : {
"type" : "text"
},
"id" : {
"type" : "integer"
},
"product_sizes" : {
"type" : "nested",
"properties" : {
"deleted_at" : {
"type" : "date"
},
"ean_code" : {
"type" : "keyword"
},
"id" : {
"type" : "integer"
},
"in_stock" : {
"type" : "boolean"
},
"is_deleted" : {
"type" : "boolean"
},
"price" : {
"type" : "float"
},
"product_id" : {
"type" : "long"
},
"uom" : {
"type" : "keyword"
},
"weight" : {
"type" : "float"
}
}
}
}
例子
{
"_index" : "inventory_553",
"_type" : "inventory",
"_id" : "16968",
"_score" : 1.0,
"_source" : {
"id" : 16968,
"name" : "By Nature Quinoa",
"product_sizes" : [
{
"id" : 14991,
"product_id" : 16968,
"ean_code" : "RBSDC8909",
"uom" : "gm",
"weight" : 500.0,
"price" : 460.0,
"is_deleted" : true,
"deleted_at" : "2019-12-03T15:26:29.854+05:30",
"in_stock" : true
},
{
"id" : 14990,
"product_id" : 16968,
"ean_code" : "TETYC8900",
"uom" : "gm",
"weight" : 250.0,
"price" : 230.0,
"is_deleted" : true,
"deleted_at" : "2019-12-03T15:26:29.855+05:30",
"in_stock" : true
}
]
}
}
目前,按价格排序产品,按价格范围查询产品尺寸,in_stock为true,is_deleted为false。有没有其他方法可以进行映射而不是嵌套类型,因为它在查询和更新嵌套文档索引时会影响性能。
解决方案
推荐阅读
- c++ - to_address 的具体用例
- json - Xamarin Forms IOS - 来自 json 字符串的 NSData
- node.js - VS Code 自动 npm 构建失败并显示“未找到 npm 命令”
- linux - 是否可以在 Kubernetes Pod 中挂载主目录(~)?
- python-3.x - 使用 cx_Freeze 创建的可执行文件在 Windows 上崩溃
- node.js - 发布表单数据时请求正文为空
- flutter - 设置秒表的毫秒数
- javascript - 展平阵列内的阵列
- file-upload - Ngnix 中的 CKAN 文件上传 413 Request Entity Too Large 错误
- javascript - 使用 Javascript 基于设备检测更改全局 td 属性