ES|QL Visualization: Metric Format Title

Hello,
I created a metric visualization using ES|QL. I was wondering if I am doing it wrong but I can't seem to format the name with spaces.

FROM logs-*
| WHERE host.name IS NOT NULL
| STATS count = COUNT(*) BY host.name
| STATS sum_count = SUM(count)
| RENAME sum_count AS Total_Hosts

I tried to do :
| RENAME sum_count AS 'Total Hosts'
I get this error:

Perhaps it cannot be done in ES|QL but theres no editing title in Visual Editor:


Hi @erikg What version are you on

8.17.1

FROM logs-*
| WHERE host.name IS NOT NULL
| STATS count = COUNT(*) BY host.name
| STATS sum_count = SUM(count)
| RENAME sum_count AS Total_Hosts

Also not sure if you are just testing but the above query is the same as this

FROM logs-*
| WHERE host.name IS NOT NULL
| STATS Total_Hosts = COUNT(*)

Because you are doing BY then just summing that...

Hey @stephenb , haha thanks for optimizing my query but I was asking regarding the format of the title "Total_Hosts". I am a picky person and would like to remove the "_" in between, I would prefer if it was able to modify the column or end result to "Total Hosts"

Back ticks... ` is the magic incantation

FROM logs-*
| WHERE host.name IS NOT NULL
| STATS `total hosts` = COUNT(*)

1 Like

Woah! thanks @stephenb