Kibana visualization like a Data Table, but with enhanced features like computed columns, filter bar, and “Split Cols” bucket
This project is a Kibana plugin that provides two visualizations:
col0 + col1
or col[0] + col[1]
)col0 > 0 ? 'OK' : 'KO'
)col0 / total * 100
or col0 / totalHits * 100
)col['Sum of duration'] / col['Count']
)col['Sales by month'] / total['Sales by month']
)timeRange.duration.months
)0,0.00
)YYYY-MM-DD
)left
, right
)<strong>{{value}}</strong>
)<span style="color: {{col0}}">{{value}}</span>
)<span style="color: {{col['color']}}">{{value}}</span>
)<a href="my-dashboard?param={{{encodeURIComponent value}}}">{{value}}</a>
)value < 0 ? 'background-color: red' : ''
)
col0
)col0 > 0
)
col0 < 0 ? 'background-color: red' : ''
)
0,1,Col2 Label
hides columns 0, 1 and the column labeled 'Col2 Label')
cat
filter, it will display only rows that contain 'cat')
iso-8859-1
)Total:
)Every release package includes a Plugin version (X.Y.Z) and a Kibana version (A.B.C).
./bin/kibana-plugin install https://github.com/fbaligand/kibana-enhanced-table/releases/download/vX.Y.Z/enhanced-table-X.Y.Z_A.B.C.zip
./bin/kibana-plugin install file:///path/to/enhanced-table-X.Y.Z_A.B.C.zip
If you don't see 'Enhanced Table' (when you go to "Create visualization" screen) or if you see any error, try these actions:
$KIBANA_HOME/optimize
folderThis is the common documentation for all computed settings:
col1[0]
join, map, filter
x = 4
myfunction(x, y) = x * y
;
col0, col1, ..., colN
: value of a previous column, referenced by its index (0-based index)col['COLUMN_LABEL']
: value of a previous column, referenced by its labelformmattedCol, formmattedCol1, ..., colN
: formatted value of a previous column, referenced by its index (0-based index)formattedCol['COLUMN_LABEL']
: formatted value of a previous column, referenced by its labeltotal0, total1, ..., totalN
: total of a previous column, referenced by its index (0-based index)total['COLUMN_LABEL']
: total of a previous column, referenced by its labeltotal
, totalHits
: total hits count matched by Elasticsearch query (given search bar & filter bar)value
: value of current computed column (only available in "Cell computed CSS" feature)timeRange
: informations about current time range, selected in Kibana time picker
duration
: object containing time range duration, in different units
years
: years count in time range (rounded up to the nearest whole number)months
: months count in time range (rounded up to the nearest whole number)weeks
: weeks count in time range (rounded up to the nearest whole number)days
: days count in time range (rounded up to the nearest whole number)hours
: hours count in time range (rounded up to the nearest whole number)minutes
: minutes count in time range (rounded up to the nearest whole number)seconds
: seconds count in time range (rounded up to the nearest whole number)milliseconds
: milliseconds count in time rangefrom
/ to
: object containing all informations on from
and to
dates of current time range
fullYear
: result of Date.getFullYear()
month
: result of Date.getMonth()
date
: result of Date.getDate()
day
: result of Date.getDay()
hours
: result of Date.getHours()
minutes
: result of Date.getMinutes()
seconds
: result of Date.getSeconds()
milliseconds
: result of Date.getMilliseconds()
time
: result of Date.getTime()
timezoneOffset
: result of Date.getTimezoneOffset()
dateString
: result of Date.toDateString()
isoString
: result of Date.toISOString()
localeDateString
: result of Date.toLocaleDateString()
localeString
: result of Date.toLocaleString()
localeTimeString
: result of Date.toLocaleTimeString()
string
: result of Date.toString()
timeString
: result of Date.toTimeString()
utcString
: result of Date.toUTCString()
col['Expiration Date'] > now() ? 'OK' : 'KO'
)Function | Description |
---|---|
cell(rowRef, colRef, defaultValue) | Returns table cell value referenced by rowRef and colRef (if it exists), or else defaultValue . rowRef is either 'first' (for first row), 'last' (for last row) or a number that is the relative target row position compared to current row (ex: -1 means the previous row). colRef is either the column label (ex: 'Count' ) or the column index (ex: 1 ). |
col(colRef, defaultValue) | Returns column value referenced by colRef (if it exists), or else defaultValue . colRef is either the column label (ex: 'Count' ) or the column index (ex: 1 ). |
countSplitCols() | Returns the count of all split columns (only if 'Split cols' bucket is used). |
dateObject(params) | Given standard Date constructor params (milliseconds since Epoch, ...), builds and returns a date object, same structure than timeRange from/to object. The result can be used in template (ex: {{ rawValue.fullYear }} ). |
durationObject(durationInMillis) | Given a duration in milliseconds, builds and returns a duration object, that breaks down the duration in years, months, weeks, days, hours, minutes, seconds and milliseconds. The result can be used in template (ex: {{ rawValue.hours }} ). |
encodeURIComponent(str) | Encodes the provided string as a Uniform Resource Identifier (URI) component. |
formattedCell(rowRef, colRef, defaultValue) | Returns formatted table cell value referenced by rowRef and colRef (if it exists), or else defaultValue . rowRef is either 'first' (for first row), 'last' (for last row) or a number that is the relative target row position compared to current row (ex: -1 means the previous row). colRef is either the column label (ex: 'Count' ) or the column index (ex: 1 ). |
formattedCol(colRef, defaultValue) | Returns formatted column value referenced by colRef (if it exists), or else defaultValue . colRef is either the column label (ex: 'Count' ) or the column index (ex: 1 ). |
indexOf(strOrArray, searchValue[, fromIndex]) | Returns the index within the calling String or Array object of the first occurrence of the specified value, starting the search at fromIndex. Returns -1 if the value is not found. |
isArray(value) | Determines whether the passed value is an Array. |
lastIndexOf(strOrArray, searchValue[, fromIndex]) | Returns the index within the calling String or Array object of the last occurrence of the specified value, searching backwards from fromIndex. Returns -1 if the value is not found. |
now() | Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC |
parseDate(dateString) | Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC and the date obtained by parsing the given string representation of a date. If the argument doesn't represent a valid date, NaN is returned. Useful to parse date columns in 'Document Table' visualization. |
replace(str, substr, replacement) | Returns a new string with first match of substr replaced by a replacement. Only the first occurrence will be replaced. |
replaceRegexp(str, regexp, replacement) | Returns a new string with all matches of a regexp replaced by a replacement. All the occurrences will be replaced. |
search(str, regexp) | Executes a search for a match between a regular expression on 'str' String. Returns the index of the first match or -1 if not found. |
sort(array[, compareFunction]) | Sorts the elements of an array in place and returns the sorted array. A compare function can be provided to customize the sort order. Example for an array of numbers: comparator(a, b) = a - b; sort(col0, comparator) |
substring(str, indexStart[, indexEnd]) | Returns the part of the string between the start and end indexes, or to the end of the string (if no index end is provided). |
sumSplitCols() | Returns the sum of all split column values (only if 'Split cols' bucket is used). |
toLowerCase(str) | Returns the calling string value converted to lowercase. |
toUpperCase(str) | Returns the calling string value converted to uppercase. |
total(colRef, defaultValue) | Returns column total referenced by colRef (if it exists), or else defaultValue . colRef is either the column label (ex: 'Count' ) or the column index (ex: 1 ). |
trim(str) | Removes whitespace from both ends of a string. |
uniq(array) | Removes duplicates from provided array so that array contains only unique values. |
This is the documentation for "Template" setting in computed columns.
A template is a Handlebars expression.
Examples:
<strong>{{value}} items</strong>
{{timeRange.from.localeDateString}} - {{timeRange.to.localeDateString}}
<a href="my-dashboard?param={{{encodeURIComponent rawValue}}}">{{value}}</a>
{{#if rawValue}}OK{{else}}KO{{/if}}
col0, col1, ..., colN
: raw value of a previous column, referenced by its index (0-based index)col['COLUMN_LABEL']
: raw value of a previous column, referenced by its labelformmattedCol, formmattedCol1, ..., colN
: formatted value of a previous column, referenced by its index (0-based index)formattedCol['COLUMN_LABEL']
: formatted value of a previous column, referenced by its labeltotal0, total1, ..., totalN
: total of a previous column, referenced by its index (0-based index)total['COLUMN_LABEL']
: total of a previous column, referenced by its labeltotal
, totalHits
: total hits count matched by Elasticsearch query (given search bar & filter bar)value
: value of current computed column, formatted using "Format" settingrawValue
: value of current computed column, not formattedtimeRange
: informations about current time range, selected in Kibana time picker
duration
: object containing time range duration, in different units
years
: years count in time range (rounded up to the nearest whole number)months
: months count in time range (rounded up to the nearest whole number)weeks
: weeks count in time range (rounded up to the nearest whole number)days
: days count in time range (rounded up to the nearest whole number)hours
: hours count in time range (rounded up to the nearest whole number)minutes
: minutes count in time range (rounded up to the nearest whole number)seconds
: seconds count in time range (rounded up to the nearest whole number)milliseconds
: milliseconds count in time rangefrom
/ to
: object containing all informations on from
and to
dates of current time range
fullYear
: result of Date.getFullYear()
month
: result of Date.getMonth()
date
: result of Date.getDate()
day
: result of Date.getDay()
hours
: result of Date.getHours()
minutes
: result of Date.getMinutes()
seconds
: result of Date.getSeconds()
milliseconds
: result of Date.getMilliseconds()
time
: result of Date.getTime()
timezoneOffset
: result of Date.getTimezoneOffset()
dateString
: result of Date.toDateString()
isoString
: result of Date.toISOString()
localeDateString
: result of Date.toLocaleDateString()
localeString
: result of Date.toLocaleString()
localeTimeString
: result of Date.toLocaleTimeString()
string
: result of Date.toString()
timeString
: result of Date.toTimeString()
utcString
: result of Date.toUTCString()
Helper | Description |
---|---|
encodeURIComponent(str) | Encodes the provided string as a Uniform Resource Identifier (URI) component. Example: <a href="my-dashboard?param={{{encodeURIComponent rawValue}}}">{{value}}</a> |
Versions and Release Notes are listed in Releases page
This Kibana plugin is inspired from computed-columns and kbn_searchtables plugins.
Thanks for their great work !
To run enhanced-table plugin in development mode (that enables hot code reload), follow these instructions:
git clone --depth 1 -b X.Y https://github.com/elastic/kibana.git # replace 'X.Y' by desired Kibana version
cd kibana/plugins
git clone https://github.com/fbaligand/kibana-enhanced-table.git enhancedTable
cd ..
kibana/.node-version
file (for instance using nvm use
command)npm install -g yarn
yarn kbn bootstrap
cd plugins/enhancedTable
export NODE_OPTIONS="--openssl-legacy-provider"
yarn install
yarn compile
yarn start
http://localhost:5601
and enjoy!To build a distributable archive, execute this command :
yarn compile-and-build --kibana-version X.Y.Z # replace 'X.Y.Z' by target Kibana version
The zip archive is generated into build
directory.
If this plugin helps you and you want to support it, you can give me a cup of coffee :)