gpt4 book ai didi

elasticsearch - 是否可以在 ElasticSearch 的 '_id' 中包含 '_source'

转载 作者:行者123 更新时间:2023-11-29 02:50:40 25 4
gpt4 key购买 nike

通常 ElasticSearch 文档存储为:

{      
"_index": "some_index",
"_type": "some_type",
"_id": "blah_blah",
"_score": null,
"_source": {
"field_a" : "value_a",
"field_b" : "value_b"
........
}

是否可以在查询数据时将_id 包含在_source 本身中?例如

{
"_index": "some_index",
"_type": "some_type",
"_id": "blah_blah",
"_score": null,
"_source": {
"_id": "blah_blah", // Added in the _source object
"field_a" : "value_a",
"field_b" : "value_b"
........
}

假设我无法控制我正在编写的数据,因此无法将其插入源中。此外,我可以读取整个对象并手动包含它,但想知道是否有办法通过 ES 查询来做到这一点。

最佳答案

_id 字段既没有索引也没有存储,这意味着它并不真正存在。_type 字段仅被索引,但不被存储。 _id 和 _type 都是 elasticsearch 的 matedata,它们连接在一起就是 id#type(_uid)。

关于elasticsearch - 是否可以在 ElasticSearch 的 '_id' 中包含 '_source',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30655030/

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