Hi guys,
I’m using elasticsearch 1.0.0RC2 and wondering if there is an
equivalent to SQL’s “having-clause” for the aggregation framework there.
Below is an example query and a link to a ticket that describes the issue
well. The part of the query that's highlighted doesn't work, and is there
purely to give an idea of what I'm after. This query (omitting the
highlighted portion) gives impression counts for every
placement-referer-device-date combo. This is fine but the output is HUGE! I
was wondering if there was a way (like a having clause or filter) to reduce
the amount of results based off some logic (in this case, impressions
counts greater than 50). Thanks all!
- Trev
curl -XPOST "XXXXXXXX/YYYYYYYY/_search?pretty=true" -d '
{
"size":0,
"query": {
"filtered": {
"query": {
"range": {
"date_time": {
"from": "ZZZZZZZ",
"to": "QQQQQQQQ",
"include_lower": true,
"include_upper": true
}
}
}
}
},
"aggs": {
"placement": {
"terms": {
"field": "placement"
},
"aggs": {
"device": {
"terms": {
"field": "device"
},
"aggs": {
"referer": {
"terms": {
"field": "referer"
},
"aggs": {
"totals": {
"date_histogram": {
"field": "date_time",
"interval": "day"
},
"aggs": {
"impression": {
"sum": {
"field": "impression"
}
,"having" : { "from" : 50 }
}
}
}
}
}
}
}
}
}
}
}
'
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c194a5e3-4f5b-4660-bf38-f1a2fad2cf55%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.