本文共 794 字,大约阅读时间需要 2 分钟。
我想用icu_collation过滤器对elasticsearch结果文档进行排序 . 所以我有索引的设置:
"settings": {
"analysis": {
"analyzer": {
"ducet_sort": {
"tokenizer": "keyword",
"filter": [ "icu_collation" ]
}
}
}
}
和映射
"mappings": {
"card": {
"properties": {
"title": {
"type": "text",
"fields": {
"sort": {
"type": "text",
"analyzer": "ducet_sort",
"index": false
}
}
}
}}}
和查询:
{
"sort": ["title.sort"]
}
但查询失败:
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [title.sort] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
在文档中,建议的排序数据类型是 keyword . 但数据类型 keyword 不支持分析器 . 此外,不建议使用fielddata:
那么有没有办法在弹性搜索中对文档进行排序,并进行一些特定的排序,例如icu_collation without fielddata = true?
谢谢 .
转载地址:http://oovqa.baihongyu.com/