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

后端 未结 9 1552
天命终不由人
天命终不由人 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:15

    After digging more, I found the solution as given below. ignore_unmapped should be explicitly set to true in the sort clause.

    "sort" : [
           { "rating": {"order" : "desc" , "ignore_unmapped" : true} },
           { "price": {"order" : "asc" , "missing" : "_last" , "ignore_unmapped" : true} }
    ]
    

    For further information have a look at the Elasticsearch references for:

    • missing values
    • ignoring unmapped fields

提交回复
热议问题