No mapping found for field in order to sort on in ElasticSearch

后端 未结 9 1550
天命终不由人
天命终不由人 2020-12-12 18:59

Elasticsearch throws a SearchParseException while parsing query if there are some documents found not containing field used in sort criteria.

9条回答
  •  北海茫月
    2020-12-12 19:26

    Let me try to help in the case that the original answer doesn't work for you. For ES 6.x try the code below, ignore_unmapped is deprecated.

    "sort" : [
           { "rating": {"order" : "desc" , "unmapped_type" : "long"} },
           { "price": {"order" : "asc" , "missing" : "_last" , "unmapped_type" : "long"} }
    ]
    

    More about sorting you can find on:

    https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-sort.html

提交回复
热议问题