Graphing boolean values after setting static convert to 0 and 1

I have a boolean field in my index.
I apply the static conversion to 0,1

I just want to create a simple graph with Timestamp on ths x-axis and 0 or 1 (or empty) on the y axis. However, when I go to lens to try to create the graph I am getting:

"This field does not work with the selected function."

For the function I select "Last Value".

I have the same when I try average or most of the others except Count which works.

However the documentation here:

states that

Aggregations like the terms aggregation use 1 and 0 for the key , and the strings "true" and "false" for the key_as_string . Boolean fields when used in scripts, return true and false

so why I am not able to select average? else I have no way to visualize this data.

As an alternative is there some way for me to use max or min on a boolean by somehow convertint it to 1, 0.

again I tried to apply a static mapping to 0 and 1, but it is not working. I still get "This field does not work with the selected function."

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

Hi @shelby . Welcome to our community. I'm sorry that you didn't get a reply here sooner.

I have a couple of questions about what you're seeing:

I'm not familiar with this technique. Are you using a runtime field?

Does your field have a pound sign beside it indicating that it is a numeric field?
Screenshot 2023-04-11 at 2.29.39 PM

Hello,
thanks for your reply, actually, I chose a different approach where I use an integer field rather than boolean and can then use the various functions without VEGA code (avg, median, max...)

I'm glad you were able to find a solution!