gpt4 book ai didi

field - 如果在 elasticsearch 查询中使用 script_fields,则不再有 _source

转载 作者:行者123 更新时间:2023-11-29 02:43:41 27 4
gpt4 key购买 nike

我正在运行一个像这样的简单查询:

{
"query": {
"term": {
"statuses": "active"
}
},
"script_fields": {
"test": {
"script": "_source.name"
}
}
}

问题是,一旦我引入了 script_fields,我的结果中就不再有 _source

我试过:

{
"fields": [
"_all"
],
"query": {
"term": {
"statuses": "active"
}
},
"script_fields": {
"email": {
"script": "_source.name"
}
}
}

{
"fields": [
"*"
],
"query": {
"term": {
"statuses": "active"
}
},
"script_fields": {
"email": {
"script": "_source.name"
}
}
}

但他们没有任何区别。除了 script_fields 之外,还有没有办法让 _source 返回?

最佳答案

fields数组中,让它加载_source:

{
"stored_fields": [
"_source"
],
"query": {
"term": {
"statuses": "active"
}
},
"script_fields": {
"email": {
"script": "_source.name"
}
}
}

关于field - 如果在 elasticsearch 查询中使用 script_fields,则不再有 _source,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11856155/

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