Elasticsearch 7.7损坏的查询

问题描述

这是在7.6.2上运行的,但是自从升级到7.7以来,它已停止工作,不知道为什么?

我正在执行嵌套查询或嵌套查询,因此三列必须为5 5 5或6 6 6。

我正在使用laravel scout驱动程序进行弹性搜索babenkoivan / scout-elasticsearch-driver

谢谢:)!

{
   "error":{
      "root_cause":[
         {
            "type":"x_content_parse_exception","reason":"[1:106] [bool] failed to parse field [must]"
         }
      ],"type":"x_content_parse_exception","reason":"[1:106] [bool] failed to parse field [must]","caused_by":{
         "type":"x_content_parse_exception","reason":"[1:106] [bool] failed to parse field [should]","caused_by":{
            "type":"x_content_parse_exception","caused_by":{
               "type":"illegal_state_exception","reason":"expected value but got [START_ARRAY]"
            }
         }
      }
   },"status":400
}

错误:

from google.cloud import datastore
client = datastore.Client()
query = client.query(kind='Kindname')
query = query.add_filter('Salary','>',280000)
l = query.fetch()
l = list(l)
if not l:
    print("No result is returned")
else:  
    d = dict(l[0])
    print(d['name'])

解决方法

您的bool/must中有两个嵌套数组,您需要删除一个:

              "must": [
      >>>       [
                  {
                    "term": {
                      "section": "205"
                    }
                  },{
                    "term": {
                      "profile": "40"
                    }
                  },{
                    "term": {
                      "rim_size": "17"
                    }
                  }
      >>>       ]
              ]

它应该看起来像这样:

              "must": [
                  {
                    "term": {
                      "section": "205"
                    }
                  },{
                    "term": {
                      "rim_size": "17"
                    }
                  }
              ]

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...