[英]How to filter distinct data in CloudSearch:AWS?
I have a query in aws cloudsearch. 我在AWS CloudSearch中有一个查询。 I did the following things
我做了以下事情
1) Created domain 1)创建域
2) uploaded the data & created indexing 2)上传数据并创建索引
I have data fields like : user_id, user_name, user_details
, etc 我有数据字段,例如:
user_id, user_name, user_details
等
My objective is to get the grouped/distinct data of particular field & its total count. 我的目标是获取特定字段的分组/不同数据及其总数。 In Cloudsearch Group by / Distinct key words not supported.
在Cloudsearch中, 按/区分关键字不支持。 So, I went through the cloudsearch documentation & done it by adding
facet.user_id={}
in my query string. 因此,我浏览了cloudsearch文档并通过在我的查询字符串中添加
facet.user_id={}
来完成它。
But I need user_name field data along with user_id and count.** Please update me regarding this. 但是我需要user_name字段数据以及user_id和count。**请对此进行更新。
Here is my full query : ?q="Tamil Selvan"&facet.user_id={}
这是我的完整查询:
?q="Tamil Selvan"&facet.user_id={}
Here is my query result : 这是我的查询结果:
{
"status": {
"rid": "isTcmOYp+AEKhpbc",
"time-ms": 6
},
"hits": {
"found": 986,
"start": 0,
"hit": []
},
"facets": {
"user_id": {
"buckets": [{
"value": "5",
"count": 213
}, {
"value": "182",
"count": 197
}]
}
}
}
My expected result : 我的预期结果:
{
"status": {
"rid": "isTcmOYp+AEKhpbc",
"time-ms": 6
},
"hits": {
"found": 986,
"start": 0,
"hit": []
},
"facets": {
"user_id": {
"buckets": [{
"value": "5",
"user_name":"Tamil Selvan",
"count": 213
}, {
"value": "182",
"user_name":"Tamil Selvi",
"count": 197
}]
}
}
}
The proper solution would be to look up the user_names
for the user_id
facet values from your datastore (which CloudSearch is not, or at least should not be). 正确的解决方案是从您的数据存储中查找
user_names
来获取user_id
构面值(CloudSearch不是或至少不应该)。
CloudSearch is a search solution; CloudSearch是一种搜索解决方案; you shouldn't be trying to ask it which user_name belongs to some user_id, as that's a question for your data store.
您不应该尝试询问哪个user_name属于某个user_id,因为这是您的数据存储区的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.