Skip to content
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

ESQL: count_distinct(_source) returns a 500 response while count(_source) works #105240

Closed
alex-spies opened this issue Feb 7, 2024 · 1 comment · Fixed by #110824
Closed
Assignees
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@alex-spies
Copy link
Contributor

The following use of count correctly returns the number of documents in an index:

from testidx [metadata _source] | stats count(_source)

However, using count_distinct results in a respons with 500 status code:

from testidx [metadata _source] | stats count_distinct(_source)

->
{"error":{"root_cause":[{"type":"esql_illegal_argument_exception","reason":"illegal agg type: _source"}],"type":"esql_illegal_argument_exception","reason":"illegal agg type: _source"},"status":500}

The behavior is the same when using synthetic source.

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Feb 7, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@alex-spies alex-spies self-assigned this Apr 23, 2024
@alex-spies alex-spies removed their assignment Jul 4, 2024
@not-napoleon not-napoleon self-assigned this Jul 11, 2024
elasticsearchmachine pushed a commit that referenced this issue Jul 12, 2024
Resolves
[#105240](#105240)

Count_distinct doesn't work on source, but the type resolution was
allowing that through.  This resulted in a 500 layer deeper in the
aggregations code.  This PR fixes the 500 error by correctly failing
during type resolution.
not-napoleon added a commit to not-napoleon/elasticsearch that referenced this issue Jul 12, 2024
Resolves
[elastic#105240](elastic#105240)

Count_distinct doesn't work on source, but the type resolution was
allowing that through.  This resulted in a 500 layer deeper in the
aggregations code.  This PR fixes the 500 error by correctly failing
during type resolution.
elasticsearchmachine pushed a commit that referenced this issue Jul 15, 2024
* [ESQL] Count_distinct(_source) should return a 400 (#110824)

Resolves
[#105240](#105240)

Count_distinct doesn't work on source, but the type resolution was
allowing that through.  This resulted in a 500 layer deeper in the
aggregations code.  This PR fixes the 500 error by correctly failing
during type resolution.

* Even hand-backporting, I messed up the capabilities file

* one more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants