I understand that I can use col[n] to reference existing columns in the data table to derive a new column. I am able to get this working fine.
I am trying to reference a field in my index pattern to derive a new column. However, it does not work because my script is not correct. As such, I would like to request for tutorials on using the expr-eval syntax in Kibana so that I can write the correct scripts and get things working. Thanks.
First of all, thanks for your interest to kibana enhanced-table plugin!
Happy to see you enjoy it
Then, to answer to your question,
firstly, don't forget that Enhanced Table (like Data Table) aims to display aggregations, not documents.
and so, you can't directly access document fields like that in a computed column formula
but you can display documents and add computed-columns, using some tips :
in "Data" tab, in "Buckets" section, click on 'Split Cols', and create a 'Terms' aggregation based on "_id" field (or any unique field)
then, add a 'Terms' bucket (size=1) or 'Top Hits' metric for each field you want to use in computed column formula. For example a 'Terms' aggregation based on "in_authentication_success" field.
then, in "Options" tab, add a new computed column, and reference each column you need for your computed column using col[1] or col1.
For example : col1 == "Y" ? 1 : 0
finally, using "Hidden columns" setting, hide every column you don't want to display. For example "_id" and "in_authentication_success" columns.
A last thing: if you want some reference documentation about what you can do in a computed column formula, click on "expr-eval" link above "Formula" setting. It provides full documentation about what you can do.
I decided to try using the Scripted Fields, and managed to calculate the Authentication Rate. Looks like I have a lot more to learn. Thanks for the support.
Through your 2 last comments, I understand that you don’t want a table line per document, but a table line per aggregation.
That’s why my tip does not solve your need.
If you want some computed field based on document fields, and then compute an aggregation on it to display on a table (or any visualization), then the Kibana scripted field is indeed the good choice!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.