Gauge element issue with SQL query data

Hello all,
i am just starting with ELK, and i am struggling with understanding this part. Could someone point to some documentation, or explain what i am doing wrong ? I have create a gauge element, in the Data portion i have:
SELECT 0.01*(COUNT(*)) as marriedcount
FROM "people"
WHERE
status = 'married'

This works just fine, the marriedcount is equal to 0.29 , then inside the 'display' portion i select value - marriedcount, and make sure that maximum value is equal to one.

But, why does this not work?
SELECT COUNT(*)/100 as marriedcount
FROM "people"
WHERE
status = 'married'

This shows zero, but /100 is supposed to be the same as *0.01 ? I have no idea what i am doing wrong here.

My second question, even if i will skip the /100 or *0.01 part, i thought i could then just increased the maximum value to 100 from 1, and the end effect should be the same. But it wasn't. The gauge was showing the correct position (color filled), but the label was: 2900% . Did i do something wrong there again ?

And my last question, i get the gauge and inside i have 29% when i use the *0.01 method for data. How can i change this tom 29% to, 'Some description 29%' ? I tried to find something about formatting, but no luck.
I have a yellow triangle to the right of the Label section stating : 'The interface for this arguemnt could not parse the value, so a fallback input is being used'

Thank you,
Greg

This shows zero, but /100 is supposed to be the same as *0.01 ?

The COUNT function will return an integer, which, when divided by another integer will result in an integer division. So if the result of COUNT is below 100, COUNT(*)/100 will return 0.

How can i change this tom 29% to, 'Some description 29%' ?

Not sure if this is the answer you're looking for, but you could potentially use SQL conversion (to string) and string functions to potentially obtain the end string you need: SELECT CONCAT('My count: ', (COUNT(*)/100)::string) AS result FROM "people".

Oh, wow Bogdan, thank you so much for detailed explanations. This explains a lot! Thank you soo much.
Can you tell, where is the ' ::string ' coming from ? Is this something related to sql standard, or kibana ?
//edit
Just found it:

:: is the cast operator

Indeed. It's a shortcut to using CAST or CONVERT functions.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.