Renaming Discover Table Headers

It seems in recent revisions of Kibana table headers on Discover tables are no longer populated when the "renderComplete" events fire.

They formerly were, and we had been using script to clean up table headers in our dashboards (i.e. underscore to space, etc).

How can scripts access Discover table headers now?

I had to move to using JQuery and a Mutation Observer to handle this...

$('#elk').on('load', function() {
	//Provide nicer column headers
	var reviseHeadingsObserver = new MutationObserver(function(mutationsList, observer) {
		for(var mutation of mutationsList) {
			node = $(mutation.addedNodes[0]);
				node.find("th > span").each(function(){
					/* eslint-disable no-invalid-this */
					//Preserve sorting buttons
					//Replace column titles with more appropriate formatting
					$(this).text($(this).text().replace(/\.|_/g," "));
					//Restore sorting button
					/* eslint-enable no-invalid-this */
	//Start observing ELK frame
	reviseHeadingsObserver.observe($("#elk").contents().find("body")[0], { attributes: false, childList: true, subtree: true });

#elk is my dashboard iframe.

It's really annoying there is no other way to handle this. Searches show the following suggestions which are all off in some way...

  • Use Data Table Visualizations: But this disables the ablility to observe document fields not included in the table columns, and doesn't provide the same inline filtering
  • Use Elasticsearch Aliases: These need to comply with the same naming conventions as other fields, and thus can't use spaces or other non-standard formats
  • Use Scripted Fields: This comes pretty close, but produces undesirable duplicate fields

There was an enhancement request for this, which had been closed, but is now re-opened. Though it's 5 years old now, so who know if it will ever be addressed:

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