AWS Cloud search: Grouping search results by field value and returning only most popular of each

这一生的挚爱 提交于 2020-01-06 08:43:51

问题


I am using aws cloud search to search a group of docs. I want to group the results by a field value, say 'color', and return only one (most relevant) of each. So if i have

doc1 : {
  color: 'green',
  number: 3,
  relevance: 'high'
},
doc2 : {
  color: 'red',
  number: 3,
  relevance: 'medium'
},
doc3 : {
  color: 'green',
  number: 3,
  relevance: 'medium
}

And searching for 'number: 3, I only want doc1 and doc2, the most popular ones in their respective 'color' groups. Is this possible?

来源:https://stackoverflow.com/questions/48526523/aws-cloud-search-grouping-search-results-by-field-value-and-returning-only-most

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!