我们有一个带有嵌套字段的映射索引。在我们的Java类中,这些字段是对象列表,有时列表可以为空(因此在json结构中,我们得到了{...“ some_nested_field”:[],...}。 当我们运行查询时,我们确实获得了预期的结果,但是也出现了错误:
"failures": [
{
"shard": 0,
"index": ".kibana",
"node": "ZoEuUdkORpuBSNs7gqiv1Q",
"reason": {
"type": "query_shard_exception",
"reason": """
failed to create query: {
"nested" : {
"query" : {
"bool" : {
"must" : [
{
"match" : {
"foobar.name" : {
"query" : "brlo",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"auto_generate_synonyms_phrase_query" : true,
"boost" : 1.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"path" : "foobar",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0
}
}
""",
"index_uuid": "xrFCunLNSv6AER_KwNMHSA",
"index": ".kibana",
"caused_by": {
"type": "illegal_state_exception",
"reason": "[nested] failed to find nested object under path [foobar]"
}
}
}
我可以假定此错误是由具有空列表的记录引起的,并且可以忽略它吗?还是这表明内部错误并且可能会丢失我的查询结果?有办法避免这种错误吗?
这是我们正在执行的查询的示例:
GET /_search
{
"query": {
"nested": {
"path": "mynested",
"query": {
"bool": {
"should" : [
{ "match" : { "mynested.name": "foo" } },
{ "match" : { "mynested.description": "bar" } },
{ "match" : { "mynested.category": "baz" } }
],
"minimum_should_match" : 1
}
}
}
}
}
ES的响应报告了10个成功分片和1个失败:
{
"took": 889,
"timed_out": false,
"_shards": {
"total": 11,
"successful": 10,
"skipped": 0,
"failed": 1,
"failures": [...]
我们确实获得了回击:
"hits": {
"total": 234450,
"max_score": 11.092936,
"hits": [ ...
答案 0 :(得分:0)
好像您已经安装了Kibana。在错误消息中,它表示找不到索引nested
的路径foobar
下的.kibana
,这是Kibana使用的索引:
"index_uuid": "xrFCunLNSv6AER_KwNMHSA",
"index": ".kibana",
"caused_by": {
"type": "illegal_state_exception",
"reason": "[nested] failed to find nested object under path [foobar]"
}
执行简单的GET /_search
全部时,还会查询Elasticsearch索引,.kibana
可能不是您想要的。
要忽略此特定索引,可以使用Multiple Indices search功能并执行以下查询:
GET /*,-.kibana/_search
希望有帮助!