Error in Workbench with SQL

Open search 2.11.0

Hi All,

I’ve a problem with the Workbench and SQL.

This sql works:
select dummyfield from dummyindex

And this works too:
select count(dummyfield) from dummyindex

But this doesn’t work:
slect dummyfidld, count(dummyfield) from dummyindex

The error is:
Dummyindex: Bad Request, this query is not runnable.

What happens?

This is a correct sql-statement…

Thanks for helping me.

Regards
Juergen

@Juergen I’m not sure what are you trying to achieve with this SQL query.

The count() function returns only a single line with an integer value, whereas the other query will return all matching rows.

Could you share the expected outcome?

I want something like that:

I want to get a table with two columsn. One with Name/label and a second with the counter for the name/label. The example has not the same columns/rows. It#s for illusration…

@Juergen That query looks completely different.
In that case, this should work.

slect dummyfield, count(dummyfield) from dummyindex group by dummyfield

This is my example executed on the security audit index.

select audit_transport_request_type.keyword, count(audit_transport_request_type.keyword) 
from security-auditlog-2023.12.15 
group by audit_transport_request_type.keyword

Hello Pablo,

yes that’s it . Blame on me. I’ve should known it …
Some kind of SQL-Blackout. :wink:

Thanks a lot.

Regards
Juergen

1 Like