TransportError(400,'illegal_argument_exception','fieldName不能为null或为空')错误发生

时间:2018-01-30 06:09:58

标签: python elasticsearch

TransportError(400,'illegal_argument_exception','fieldName不能为null或为空')错误发生。 我正在使用ElasticSearch,写了一个方法

def user_data(distance,start_time,end_time):
    param = {
     "query": {
     "bool": {
       "filter": {
        "geo_distance": {
          "distance": distance,
          "distance_type": "plane",
        }
      },
      "must": [
        {
          "match": {
            "start_time": start_time
          }
        },
        {
          "match": {
            "end_time": end_time
           }
         }
       ]
     }
   }
  }

  results = get_user().query(param)
查询方法

中的

def query(self, params, es_index, es_index_type, size=10000):
  results = []
  field = params.get('fields', False)
  timeout_param = "{}s".format(self._es_request_timeout)

  response = self.client().search(index=es_index, doc_type=es_index_type, scroll='5m', size=size, body=params, timeout=timeout_param)

我认为编写参数的方式还可以,所以我真的无法理解为什么会发生这种错误。我在Google中搜索了这个错误,我发现很多错误会导致编写param的错误方法。我写错了查询?我该如何解决这个问题?

0 个答案:

没有答案