Kibana ElasticSearch查询出现错误“All shared Failed”“Failed to create query

xxhby3vn  于 2023-02-27  发布在  Kibana
关注(0)|答案(1)|浏览(714)

我是ElasticSearch查询的新手,当我使用kibana控制台执行查询时,查询显示错误,查询为

GET /_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "languageSkills.languageId": "10"
          }
        }
      ],
      "must_not": [
        {
          "term": {
            "RemoveFromPositions": "Guid_Value_Here"
          }
        },
        {
          "nested": {
            "path": "positions",
            "query": {
              "bool": {
                "must": [
                  {
                    "term": {
                      "positions.PositionID": "Guid_Value_here"
                    }
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}

我得到的例外是,我不知道为什么我得到这个,我已经使用这个很长一段时间了,然后我升级了我的ElasticSearch和kibana都在那之后我面临这个问题

{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
        "index_uuid": "eCFSSERoQ-a1jAW4_-ccJg",
        "index": ".kibana_1"
      },
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
        "index_uuid": "ncu-6WiVSDaNttPJwb_0og",
        "index": ".kibana_task_manager"
      },
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
        "index_uuid": "AN6WIKyhSSicELb8AihmWw",
        "index": "My_Index_For_ES"
      },
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
        "index_uuid": "Ao-Ded1dVfgXZfydvUFpli",
        "index": "My_Index_For_ES2"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": ".kibana_1",
        "node": "dxDWdF4VFpu8jcqBk50W2W",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
          "index_uuid": "eCFSSERoQ-a1jAW4_-ccJg",
          "index": ".kibana_1",
          "caused_by": {
            "type": "illegal_state_exception",
            "reason": "[nested] failed to find nested object under path [positions]"
          }
        }
      },
      {
        "shard": 0,
        "index": ".kibana_task_manager",
        "node": "dxDWdF4VFpu8jcqBk50W2W",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
          "index_uuid": "ncu-6WiVSDaNttPJwb_0og",
          "index": ".kibana_task_manager",
          "caused_by": {
            "type": "illegal_state_exception",
            "reason": "[nested] failed to find nested object under path [positions]"
          }
        }
      },
      {
        "shard": 0,
        "index": "My_Index_For_ES",
        "node": "dxDWdF4VFpu8jcqBk50W2W",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
          "index_uuid": "AN6WIKyhSSicELb8AihmWw",
          "index": "My_Index_For_ES",
          "caused_by": {
            "type": "illegal_state_exception",
            "reason": "[nested] nested object under path [positions] is not of nested type"
          }
        }
      },
      {
        "shard": 0,
        "index": "My_Index_For_ES2",
        "node": "dxDWdF4VFpu8jcqBk50W2W",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: {\n  \"bool\" : {\n    \"must\" : [\n      {\n        \"term\" : {\n          \"languageSkills.languageId\" : {\n            \"value\" : \"10\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"must_not\" : [\n      {\n        \"term\" : {\n          \"RemoveFromPositions\" : {\n            \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"nested\" : {\n          \"query\" : {\n            \"bool\" : {\n              \"must\" : [\n                {\n                  \"term\" : {\n                    \"positions.PositionID\" : {\n                      \"value\" : \"12fv567a-1ede-2f0-a75a-d1d236dcb38f\",\n                      \"boost\" : 1.0\n                    }\n                  }\n                }\n              ],\n              \"adjust_pure_negative\" : true,\n              \"boost\" : 1.0\n            }\n          },\n          \"path\" : \"positions\",\n          \"ignore_unmapped\" : false,\n          \"score_mode\" : \"avg\",\n          \"boost\" : 1.0\n        }\n      }\n    ],\n    \"adjust_pure_negative\" : true,\n    \"boost\" : 1.0\n  }\n}",
          "index_uuid": "Ao-Ded1dVfgXZfydvUFpli",
          "index": "My_Index_For_ES2",
          "caused_by": {
            "type": "illegal_state_exception",
            "reason": "[nested] nested object under path [positions] is not of nested type"
          }
        }
      }
    ]
  },
  "status": 400
}
vc9ivgsu

vc9ivgsu1#

实际上,您正在查询所有索引,而.kibana索引没有您在查询中指定的字段。
一般来说,你应该更喜欢查询你所需要的索引集,不仅是你的查询会更快,但你也会得到更少的错误,像这样一个:

GET <your_index_name>/_search

还要注意,确切的错误是
[nested]无法在路径[positions]下找到嵌套对象
这意味着您的positions字段不是nested类型,因此您只需删除nested查询并将其添加到bool/must数组中

{
                "term": {
                  "positions.PositionID": "Guid_Value_here"
                }
              }

相关问题