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

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

    Apparently ElasticSearch won't sort on null values. I was assuming it would treat null as being at the start or end (as with SQL ordering) but I believe it also triggers this error.

    So if you see this error, you may need to ensure the sort attribute has a default value when it's sent to ElasticSearch.

    I had this error with Rails+ElasticSearch+Tire because the sort column didn't have a default value, so was being sent to ES as null.

    This issue indicates null values are handling, but it wasn't my experience. It's something worth trying anyway.

提交回复
热议问题