Aggregation count by unique uid in GroupBy Query

Hi guys,

I have the requirement to get the exact unique count of User ID.

The filter Should count only one per uid. I need unique user number count for every dim1 value.

**Row Data : **

{“uid”:“user1”, “dim1” : [“abcd”, “abce”]}

{“uid”:“user2”, “dim1” : [“abrf”]}

{“uid”:“user3”, “dim1” : [“abct”]}

**Query : **

{

“queryType”: “groupBy”,

“dataSource”: “segment”,

“granularity”: {

“period”: “P1W”,

“type”: “period”

},

“dimensions”: [

{

“type”: “regexFiltered”,

“delegate”: {

“type”: “default”,

“dimension”: “dim1”,

“outputName”: “dim1”

},

“pattern”: “^(ab).*”

}

],

“filter”: {

“type”: “and”,

“fields”: [

{

“type”: “regex”,

“dimension”: “dim1”,

“pattern”: “ab*.*”

}

]

},

“aggregations”: [

{

“type”: “count”,

“name”: “total_numz_count”,

“fieldName”: “numz_sum”

}

],

“intervals”: [

“2016-11-20T00:00/2016-11-20T02:00”

]

}

**Expected Result : **

[{“version”:“v1”,“timestamp”:“2016-11-14T00:00:00.000Z”,“event”:{“dim1”:“abcd”,“total_numz_count”:2}},{“version”:“v1”,“timestamp”:“2016-11-14T00:00:00.000Z”,“event”:{“dim1”:“abrf”,“total_numz_count”:1}},{“version”:“v1”,“timestamp”:“2016-11-14T00:00:00.000Z”,“event”:{“dim1”:“abct”,“total_numz_count”:1}}]

Actually, I don’t want repeated records for the same uid.

Do I need to add any aggregator or need to build the specific query?

Thanks,

Jitesh

I can not do GroupBy uid bcoz it will very query and will take time also.
uid is unique in all row.

is cardinality aggregator count indicates the group in result for GroupBy Query ?