-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL: Allow MIN() and MAX() aggregate functions to operate also on arguments of type keyword #35639
Labels
Comments
Pinging @elastic/es-search-aggs |
added minor formatting to your post Thanks for the suggestion. This would essentially translate We could support this through a |
matriv
added a commit
to matriv/elasticsearch
that referenced
this issue
Jan 28, 2019
FIRST and LAST can be used with one argument and work similarly to MIN and MAX but they are implemented using a Top Hits aggregation and therefore can also operate on keyword fields. When a second argument is provided then they return the first/last value of the first arg when its values are ordered ascending/descending (respectively) by the values of the second argument. Currently because of the usage of a Top Hits aggregation FIRST and LAST cannot be used in the HAVING clause of a GROUP BY query to filter on the results of the aggregation. Closes: elastic#35639
matriv
changed the title
Allow MIN() and MAX() aggregate functions to operate also on arguments of type keyword
SQL: Allow MIN() and MAX() aggregate functions to operate also on arguments of type keyword
Jan 28, 2019
matriv
added a commit
that referenced
this issue
Jan 31, 2019
FIRST and LAST can be used with one argument and work similarly to MIN and MAX but they are implemented using a Top Hits aggregation and therefore can also operate on keyword fields. When a second argument is provided then they return the first/last value of the first arg when its values are ordered ascending/descending (respectively) by the values of the second argument. Currently because of the usage of a Top Hits aggregation FIRST and LAST cannot be used in the HAVING clause of a GROUP BY query to filter on the results of the aggregation. Closes: #35639
matriv
added a commit
that referenced
this issue
Jan 31, 2019
FIRST and LAST can be used with one argument and work similarly to MIN and MAX but they are implemented using a Top Hits aggregation and therefore can also operate on keyword fields. When a second argument is provided then they return the first/last value of the first arg when its values are ordered ascending/descending (respectively) by the values of the second argument. Currently because of the usage of a Top Hits aggregation FIRST and LAST cannot be used in the HAVING clause of a GROUP BY query to filter on the results of the aggregation. Closes: #35639
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allow
MIN()
andMAX()
aggregate functions to operatealso on arguments of type keyword (and eventually also text) apart from the numeric and date.
This would simplify queries using GROUP BY returning columns of type keyword (and eventually text) that is not part of the group by statement. This would also harmonize with the expected behavior from persons used to sql in for example Sql Server.
This would return the last value in alphabetic order for the field
fieldOfTypeKeyword
in the group defined by the group by statement. The min() function would do the inverse.The text was updated successfully, but these errors were encountered: