gpt4 book ai didi

c# - Elasticsearch 错误 "failed to find nested object under path"

转载 作者:行者123 更新时间:2023-12-03 01:19:17 35 4
gpt4 key购买 nike

我知道这之前已经被问过多次,但现有的问题或答案都没有帮助我。

查询 Elasticsearch 时出现以下错误:

[nested] failed to find nested object under path [departures]



我正在运行的查询如下:
{
"explain":true,
"from":0,
"query":{
"nested":{
"path":"departures",
"query":{
"term":{
"departures.yearMonth":{
"value":202007
}
}
}
}
},
"size":20
}

我的映射如下:
{
"tours":{
"mappings":{
"properties":{
"departures":{
"type":"nested",
"properties":{
"guaranteed":{
"type":"boolean"
},
"spacesRemaining":{
"type":"long"
},
"startDate":{
"type":"date"
},
"yearMonth":{
"type":"long"
}
}
}
}
}
}
}

最后,从 Kibana 截取的屏幕截图显示我的索引中有一个有效条目。
enter image description here

任何想法为什么这个查询会像这样失败?

最佳答案

尝试设置 ignore_unmapped在您的查询请求中标记为 true

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html

ignore_unmapped (Optional, boolean) Indicates whether to ignore an unmapped path and not return any documents instead of an error. Defaults to false.

If false, Elasticsearch returns an error if the path is an unmapped field.

You can use this parameter to query multiple indices that may not contain the field path.

关于c# - Elasticsearch 错误 "failed to find nested object under path",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61067559/

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