Link Search Menu Expand Document Documentation Menu

故障排除

SQL 插件是无状态的,因此故障排除主要集中在为什么特定查询会失败。

最常见的错误是可怕的空指针异常,它可能在解析错误期间或使用错误的 HTTP 方法(POST 与 GET,反之亦然)时发生。POST 方法和 HTTP 请求体提供最一致的结果

POST _plugins/_sql
{
  "query": "SELECT * FROM my-index WHERE ['name.firstname']='saanvi' LIMIT 5"
}

如果查询行为不符合预期,请使用 _explain API 查看翻译后的查询,然后进行故障排除。对于大多数操作,_explain 返回 OpenSearch 查询 DSL。对于 UNIONMINUSJOIN,它返回的内容更像是 SQL 执行计划。

请求示例

POST _plugins/_sql/_explain
{
  "query": "SELECT * FROM my-index LIMIT  50"
}

示例响应

{
  "from": 0,
  "size": 50
}

索引映射验证异常

如果看到以下验证异常,请确保查询中的索引不是索引模式,并且没有多种类型

{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "When using multiple indices, the mappings must be identical.",
    "type": "VerificationException"
  },
  "status": 503
}

如果这些步骤无效,请在此处提交 Github Issue。

剩余 350 字符

有问题?

想要贡献?