我有一个带链接的产品,已映射
{
"mappings": {
"product": {
"properties": {
"links": {
"type": "nested"
}
}
}
}
}
如何对链接的长度进行排序?我尝试了以下但是不起作用:
{
"sort": {
"_script": {
"script": "doc['links'].values.length",
"order": "desc",
"type": "string"
}
}
}
我得到的错误是:["org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:81)","org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:39)","doc['links'].values.length"," ^---- HERE"],"script":"doc['links'].values.length","lang":"painless","caused_by":{"type":"illegal_argument_exception","reason":"No field found for [links] in mapping with types []"}}}]},"status":500}