lundi 6 juillet 2015

How to filter distinct data in CloudSearch:AWS?

I'm new to aws cloudsearch and i have a query in that. I did the following things
1) Created domain
2) uploaded the data & created indexing

I have data fields like : user_id, user_name, user_details, etc

My objective is to get the grouped/distinct data of particular field & its total count. In Cloudsearch Group by / Distinct key words not supported. So, I went through the cloudsearch documentation & done it by adding facet.user_id={} in my query string.

But i need user_name field data along with user_id and count. Please update me regarding this.

Here is my full query : ?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
            }]
        }
    }
}




Aucun commentaire:

Enregistrer un commentaire