随着ElasticSearch计划删除映射类型,这是否也意味着嵌套文档和嵌套查询的弃用?ElasticSearch 将/将如何支持无类型上下文中嵌套对象的查询?
我正在考虑的功能是能够仅返回匹配搜索条件的嵌套数组中的命中。
编辑 1:ElasticSearch 版本 6 中的示例映射 + 查询
ElasticSearch 6 映射
{
"rec": {
"mappings": {
"history": {
"properties": {
"dateCompleted": {
"type": "keyword"
},
"dateCreated": {
"type": "keyword"
},
"dateOrdered": {
"type": "keyword"
},
"dateToArrive": {
"type": "keyword"
},
"details": {
"type": "nested",
"properties": {
"clientId": {
"type": "keyword"
},
"company": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"orderNumber": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}
}
ElasticSearch 6 查询
{
"from": 0,
"query": {
"nested": {
"inner_hits": {},
"path": "details",
"query": {
"bool": {
"must": [
{
"match_phrase": {
"details.company.keyword": {
"query": "ABCD"
}
}
}
]
}
}
}
},
"size": 10,
"sort": [],
"_source": false
}