【发布时间】:2018-02-22 22:29:54
【问题描述】:
我正在使用 elasticsearch 构建自动完成搜索,因此我需要查询 3 个索引 posts、comments、authors。我有以下查询:
{
"query":{
"query_string":{
"query":"something"
}
}
}
电话:
curl -X GET 'http://localhost:9200/posts,comments,authors/_search?pretty' -d '{
"query": {
"query_string": {
"query": "something"
}
}
}'
我需要按特定的索引字段对结果进行排序,例如:
帖子索引有一个名为comments_count、cmets votes_count 和作者posts_count 的字段。比较帖子时,应按comments_count排序,cmets然后votes_count,作者然后posts_count。
有可能做这样的事情吗?我不想将索引合并为一个,因为它们索引完全不同的文档。
【问题讨论】:
标签: elasticsearch