gpt4 book ai didi

json - Elasticsearch 的 "include_in_parent"/"include_in_root"是如何工作的?它应该显示在 '_source' 中吗?

转载 作者:行者123 更新时间:2023-12-02 22:17:22 24 4
gpt4 key购买 nike

在像这样的简单 Elasticsearch 映射中:

{
"personal_document": {
"analyzer": "standard",
"_timestamp": {
"enabled": true
},
"properties": {
"description": {
"type": "multi_field",
"fields": {
"sort": {
"type": "string",
"index": "not_analyzed"
},
"description": {
"type": "string",
"include_in_root": true
}
}
},
"my_nested": {
"type": "nested",
"include_in_root": true,
"properties": {
"description": {
"type": "string"
}
}
}
}
}
}

.... "include_in_root": true 不是应该将字段 my_nested.description 添加到根文档吗?

And during a query am I not supposed to see THAT field into the _source field?

Specifying an highlight directive on the field 'my_nested.description' would automatically retrieve the _included_in_root value_ instead of the nested field?

(像这样) “强调”: { “领域”:{ “描述”: {}, “my_nested.description”:{} }


还是我对official nested type documentation有什么误解? ?(这个不是很清楚)

最佳答案

如果在嵌套文档上启用了 include_in_parent 或 include_in_root 选项,那么 Elasticsearch 会在内部使用父文档上展平的嵌套字段对数据进行索引。然而,这只是 Elasticsearch 内部的,您永远不会在 _source 字段中看到它们。

If the user field is of type object, this document would be indexed internally something like this...

因为它被引用 here .

因此,您通过引用嵌套文档的字段继续执行操作(如您提到的突出显示)。您引用的突出显示语法应该如下所示

"highlight": {
"fields": {
"my_nested.description": {}
}
}

而不是

"highlight": {
"fields": {
"description": {}
}
}

关于json - Elasticsearch 的 "include_in_parent"/"include_in_root"是如何工作的?它应该显示在 '_source' 中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28274981/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com