Get records by adding metrics in Filter with greater than filter

HI ,

I am using druid-0.9.1.1.

{“id”:“123”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:2, “metrics2”:1}

{“id”:“124”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:0, “metrics2”:0}

{“id”:“125”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:1, “metrics2”:0}

{“id”:“126”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:20, “metrics2”:2}

{“id”:“127”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:5, “metrics2”:1}

Here, metrics1 and metrics2 are aggregation metrics field.

I want fetch that record which having greater than metrics1 value.

e.g. metrics1 >= 5

result should be :

{“id”:“126”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:20, “metrics2”:2}

{“id”:“127”, “dim1”:“val1”,“dim2”:“val2”,“dim3”:“val3”,“metrics1”:5, “metrics2”:1}

“result”:
{

“total_numz_count”: 2
“total_metrics1_count”: 25

“total_metrics2_count”: 3

}

I used JavaScript, bound filter type but its not returning expected value.

**JavaScript filter type Query : **

{

“queryType”: “timeseries”,

“dataSource”: “segment_1”,

“granularity”: “day”,

“filter”: {

“type”: “and”,

“fields”: [

{

“type”: “javascript”,

“dimension”: “metrics1”,

“function”: “function(x) { return(x>=5)}”

}

]

},

“aggregations”: [

{

“type”: “count”,

“name”: “total_numz_count”,

“fieldName”: “numz_sum”

},

{

“type”: “longSum”,

“name”: “total_metrics1_count”,

  "fieldName": "metrics1"

},

{

  "type": "longSum",

  "name": "total_metrics2_count",

  "fieldName": "metrics2"

}

],

“intervals”: [

“2016-09-01T00:00/2016-09-01T23:01”

]

}

Bound Filter Type Query :

{

“queryType”: “timeseries”,

“dataSource”: “segment_1”,

“granularity”: “day”,

“filter”: {

“type”: “and”,

“fields”: [

{

“type”: “bound”,

“dimension”: “metrics1”,

“lower”: “5”

}

]

},

“aggregations”: [

{

“type”: “count”,

“name”: “total_numz_count”,

“fieldName”: “numz_sum”

},

{

“type”: “longSum”,

“name”: “total_metrics1_count”,

  "fieldName": "metrics1"

},

{

  "type": "longSum",

  "name": "total_metrics2_count",

  "fieldName": "metrics2"

}

],

“intervals”: [

“2016-09-01T00:00/2016-09-01T23:01”

]

}

Both queries are not working for me.

Is there any other way to find this?

Do I need to create simple dimension for metrics1 w/o agregation ?

Thanks,

Jitesh

Are you trying to do a filter on a dimension or a metric?

i am having the same problem

filter" : {

“type” : “and”,

“fields” : [ {

“type” : “and”,

“dimension” : null,

“value” : null,

“function” : null,

“fields” : [ {

“type” : “bound”,

“dimension” : “metric_name”,

“value” : null,

“function” : null,

“fields” : null,

“lower” : null,

“upper” : “104852865”,

“ordering” : “numeric”,

“lowerStrict” : null,

“upperStrict” : true,

“intervals” : null,

“field” : null,

“values” : null,

“pattern” : null

} ],

“lower” : null,

“upper” : null,

“ordering” : null,

“lowerStrict” : null,

“upperStrict” : null,

“intervals” : null,

“field” : null,

“values” : null,

“pattern” : null

}]

}

providing this value as upper bound gives me blank result 104852865 when upperStrict is set to true, though i have values less than 104852865 in the datasource.

And the same query works fine and gives me result if i set upperStrict to false.

The druid version is 0.10.