是否可以按Elasticsearch中的“ date_range”字段排序? 如果是,怎么办?
我的Elasticsearch版本:6.3.0
您可以在下面找到我的示例。
我想按“ dater”排序
谢谢
映射:
PUT testindex
{
"mappings": {
"datetest": {
"properties": {
"created": {
"type": "date"
},
"id": {
"type": "keyword"
},
"Name": {
"type": "keyword"
},
"dater": {
"type": "date_range"
}
}
}
}
}
查询:
GET /testindex/_search
{
"query": {
"match_all": {}
},
"sort": [
{
"dater": {
"order": "desc"
}
}
]
}
结果:
error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Fielddata is not supported on field [dater] of type [date_range]"
}
]
}