【发布时间】:2014-04-23 21:57:22
【问题描述】:
我在尝试对 Elasticsearch 中的嵌套多字段属性进行排序时遇到了问题。两个多字段之一有效,另一个为每个值返回 null。
我的可排序分析器:
"analyzer": {
"sortable": {
"type": "custom",
"tokenizer": "keyword",
"filter": ["lowercase"]
}
}
映射:
{
"doc": {
"properties": {
"id" : {
"type": "long"
},
"name": {
"type": "string",
"index": "analyzed",
"analyzer": "snowball",
"fields": {
"sortable": {
"type": "string",
"analyzer": "sortable"
}
}
},
"website": {
"type": "nested",
"properties": {
"domain": {
"type": "string",
"analyzer": "snowball",
"fields": {
"sortable": {
"type": "string",
"analyzer": "sortable"
}
}
},
"created": {
"type": "date"
}
}
}
}
}
}
一个完整的工作示例是here。注意底部的四个搜索。按名称排序或 name.sortable 都在结果的排序部分显示值。按 website.domain 排序会在 sort 部分显示一个值,但 website.domain.sortable 总是显示 null。
我希望我只是在这里做一些愚蠢的事情,但对于我的生活,我看不到什么。这是在 Elasticsearch 1.1.0 中。我也很乐意采用其他解决方案,尽管我讨厌用两个不同的名字在该领域打两次。
【问题讨论】:
标签: elasticsearch