我正在尝试搜索并对结果进行排序。但是,我收到一个错误,不知道为什么。ElasticSearch - 排序不起作用
编辑 - 我会提供我的完整映射。
"myindex": {
"mappings": {
"mytype": {
"dynamic_templates": [
{
// Dynamic templates here!
}
],
"properties": {
"fieldid": {
"type": "keyword",
"store": true
},
"fields": {
"properties": {
"myfield": {
"type": "text",
"fields": {
"sort": {
"type": "keyword",
"ignore_above": 256
}
},
"analyzer": "myanalyzer"
}
}
},
"isDirty": {
"type": "boolean"
}
}
}
}
}
}
当我执行搜索与整理,就像这样:
POST /index/_search
{
"sort": [
{ "myfield.sort" : {"order" : "asc"}}
]
}
我得到以下错误:
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "No mapping found for [myfield.sort] in order to sort on",
"index_uuid": "VxyKnppiRJCrrnXfaGAEfA",
"index": "index"
}
]
"status": 400
}
我在下面的文档elasticsearch。 DOCUMENTATION
我也检查此链接: DOCUMENTATION
有人能为我提供帮助?
你明白了什么叫当'卷曲-XGET本地主机:9200/index'? – Val
我得到映射。但问题不在于映射,而在于搜索。您可以在最后的评论中查看解决方案。无论如何,谢谢:) – NatsuDragonEye