Need help creating a query(using datasketches) that does a full cohort analysis ( AMENDED)

Hello

Below contains the example shown on http://druid.io/docs/latest/development/extensions-core/datasketches-theta.html. I believe what the results of this query show is just one segment of a cohort analysis. This would be the segment that starts on 2014-10-01T00:00:00.000Z. I would like to create a query that can show multiple segments. For example, users who visited product ‘A’ on 2014-10-02T00:00:00.000Z (but did not visit on 2014-10-01T00:00:00.000Z) and the subsequent days they were retained as per the example below. Currently I’m in a situation where to get a full cohort analysis I need amend the dates on the first filtered aggregation and re-run the query. Does anyone have any idea on how to achieve this in one query.

{

“queryType”: “groupBy”,

“dataSource”: “test_datasource”,

“granularity”: “ALL”,

“dimensions”: ,

“filter”: {

“type”: “or”,

“fields”: [

{“type”: “selector”, “dimension”: “product”, “value”: “A”}

]

},

“aggregations”: [

{

“type” : “filtered”,

“filter” : {

“type” : “and”,

“fields” : [

{

“type” : “selector”,

“dimension” : “product”,

“value” : “A”

},

{

“type” : “interval”,

“dimension” : “__time”,

“intervals” : [“2014-10-01T00:00:00.000Z/2014-10-07T00:00:00.000Z”]

}

]

},

“aggregator” : {

“type”: “thetaSketch”, “name”: “A_unique_users_week_1”, “fieldName”: “user_id_sketch”

}

},

{

“type” : “filtered”,

“filter” : {

“type” : “and”,

“fields” : [

{

“type” : “selector”,

“dimension” : “product”,

“value” : “A”

},

{

“type” : “interval”,

“dimension” : “__time”,

“intervals” : [“2014-10-08T00:00:00.000Z/2014-10-14T00:00:00.000Z”]

}

]

},

“aggregator” : {

“type”: “thetaSketch”, “name”: “A_unique_users_week_2”, “fieldName”: “user_id_sketch”

}

},

],

“postAggregations”: [

{

“type”: “thetaSketchEstimate”,

“name”: “final_unique_users”,

“field”:

{

“type”: “thetaSketchSetOp”,

“name”: “final_unique_users_sketch”,

“func”: “INTERSECT”,

“fields”: [

{

“type”: “fieldAccess”,

“fieldName”: “A_unique_users_week_1”

},

{

“type”: “fieldAccess”,

“fieldName”: “A_unique_users_week_2”

}

]

}

}

],

“intervals”: [“2014-10-01T00:00:00.000Z/2014-10-14T00:00:00.000Z”]

}

``