【发布时间】:2017-05-22 12:27:35
【问题描述】:
我正在使用 Firebase 手电筒查询我的 Firebase 数据库,但我无法对结果进行排序。
我正在使用这个查询:
this.elasticConfig = {
type: 'guest',
body: {
from: 0,
size: 20,
query: {
bool: {
must: [
{
match: {
isApproved: false
}
},
{
match: {
isCheckedIn: false
}
},
{
match: {
eventId: event.id
}
}
]
}
},
sort: [
{
name: {
order: 'asc'
}
}
]
}
};
但我从 elasticsearch 收到此错误:
Fielddata is disabled on text fields by default. Set fielddata=true on [name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.
我觉得奇怪的是,一个简单的字母排序操作会要求您使用“重要内存”。
我在查询中遗漏了什么吗?或者我还能做些什么来让它发挥作用?
【问题讨论】:
-
这是什么ES版本?
-
另外,如果这是 ES 5 并且该字段已被 Elasticsearch 自动映射,请尝试在
name.keyword上进行排序。否则,您需要将name字段设为keyword,添加keyword子字段以搜索name.keyword。 -
@AndreiStefan 这行得通 :) 随意添加答案,我会接受。
标签: firebase elasticsearch firebase-realtime-database elasticsearch-5