Open astefan opened 6 years ago
Pinging @elastic/es-search-aggs
I think the error is correct; HAVING
is used for aggregates only not fields (whether grouped or not).
Converting HAVING
to WHERE
should fix the error and the query should work.
That's fair @costin. How about the following use case?
sql> select dayname("hire_date") from "test_emp" group by dayname("hire_date") having max(emp_no) > ASCII(dayname("hire_date"));
Bad request [Found 1 problem(s)
line 1:82: Cannot filter HAVING on non-aggregate [hire_date]; consider using WHERE instead]
@elastic/es-ql
Pinging @elastic/es-analytical-engine (Team:Analytics)
A query like this one is normally translated into ES DSL more or less like this:
While ES does offer
avg
,min
,max
etc metric aggregations, we would need the key of parent aggregation (thecomposite
one) for thebucket_selector
script, which I am not sure it's possible.