简体   繁体   English

elasticsearch 返回 RequestError 400

[英]elasticsearch returns RequestError 400

GET 31searchskurecord/_search
{
    "query": {
        "match_all": {}
    
    }
    , "sort": [
      {
        "sort_order": {
          "order": "desc"
        }
      }
    ]
}

returns RequestError(400, 'search_phase_execution_exception', 'No mapping found for [sort_order] in order to sort on')返回 RequestError(400, 'search_phase_execution_exception', '没有找到 [sort_order] 的映射以便排序')

This is because you might not be having any field sort_order in your index.这是因为您的索引中可能没有任何字段sort_order

You must be getting this error -您一定会收到此错误-

"root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "No mapping found for [sort_order] in order to sort on",
        "index_uuid": "n0rYitJtQZ2ku3ahDqsohQ",
        "index": "67297292"
      }
    ],

To know more about sort order you can refer to this official documentation要了解有关排序顺序的更多信息,您可以参考此官方文档

If you want to sort on the basis of a particular field, you need to modify your query as如果要根据特定字段进行排序,则需要将查询修改为

{
  "query": {
    "match_all": {}
  },
  "sort": [
    {
      "<field-name>": {      // add your field name here
        "order": "desc"
      }
    }
  ]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RequestError:RequestError(400,search_phase_execution_exception未能为elasticsearch中的输入字符串创建查询 - RequestError: RequestError(400, search_phase_execution_exception failed to create query For input string in elasticsearch elasticsearch.exceptions.RequestError: RequestError(400, &#39;mapper_parsing_exception&#39;, &#39;没有在字段 [texts] 上声明的类型 [string] 的处理程序&#39;) - elasticsearch.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', 'No handler for type [string] declared on field [texts]') Python ES2CSV -elasticsearch.exceptions.RequestError: RequestError(400, u'search_phase_execution_exception', u'编译错误') - Python ES2CSV -elasticsearch.exceptions.RequestError: RequestError(400, u'search_phase_execution_exception', u'compile error') Python Elasticsearch,RequestError:TransportError(400,u&#39;search_phase_execution_exception&#39;)间歇性地发生。 为什么? - Python Elasticsearch, RequestError: TransportError(400, u'search_phase_execution_exception') happens intermittently. Why? Django/Haystack 错误:elasticsearch.exceptions.RequestError: TransportError(400, &#39;parsing_exception&#39;,...) - Django/Haystack error: elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception',…) Python - elasticsearch.exceptions.RequestError - Python - elasticsearch.exceptions.RequestError 更新elasticsearch中的索引时出现RequestError - RequestError while updating the index in elasticsearch RequestError:TransportError(400,u&#39;parsing_exception&#39;)Django干草堆 - RequestError: TransportError(400, u'parsing_exception') django haystack Elasticsearch解析异常400 - Elasticsearch parsing exception 400 Python 请求返回 400 - Python Requests Returns 400
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM