选择不同的我的文档的集合属于少数作者:从elasticsearch
[
{ id: 1, author_id: 'mark', content: [...] },
{ id: 2, author_id: 'pierre', content: [...] },
{ id: 3, author_id: 'pierre', content: [...] },
{ id: 4, author_id: 'mark', content: [...] },
{ id: 5, author_id: 'william', content: [...] },
...
]
我想检索和分页基于作者的ID最匹配的文档的不同选择:
[
{ id: 1, author_id: 'mark', content: [...], _score: 100 },
{ id: 3, author_id: 'pierre', content: [...], _score: 90 },
{ id: 5, author_id: 'william', content: [...], _score: 80 },
...
]
这里就是我目前做的(伪代码):
unique_docs = res.results.to_a.uniq{ |doc| doc.author_id }
问题正确分页:如何选择20个“独特”文档?
有些人指着term facets,但我并没有真正做一个标签云:
- Distinct selection with CouchDB and elasticsearch
- http://elasticsearch-users.115913.n3.nabble.com/Getting-Distinct-Values-td3830953.html
感谢,
平硐
什么分数的结果吗? – ramseykhalaf
术语方面做得很好。你应该试试。 – shyos
喜@shyos如果长期小面方面,他们告诉我,有一些独特的文件,而不是1。他们怎么得分和其他文件中 - 2.我不认为它可以分页(例如,显示20个文件跳过第一个300。不同的结果) - 3.他们不允许突出显示和所有其他好处 –