gpt4 book ai didi

elasticsearch - Elasticsearch 虽然声明为 “store”,但不会在结果中返回字段值=“yes”

转载 作者:行者123 更新时间:2023-12-03 00:28:08 24 4
gpt4 key购买 nike

我正在尝试使用以下映射为特定文档编制索引

{
"session": { "_source": {
"enabled": false
},
"properties": {
"sessionId": {
"type": "string"
},
"start": {
"type": "date"
},
"text": {
"type": "string"
, "store": "yes"
}
}
}
}

搜索文字时
{
"query": {
"bool": {
"must": [
{
"text": {
"session.text": "something"
}
}
]
}
}
}

我确实得到结果,但是session.text值不会存储在结果中

最佳答案

禁用_source时,您需要明确说明所需的字段,或指定*来获取所有字段。

在此处记录:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html

对于您的情况,您想在搜索中指定"fields": ["text"]

关于elasticsearch - Elasticsearch 虽然声明为 “store”,但不会在结果中返回字段值=“yes”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21580001/

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