Set data view format in index template

Hi,

I have multiple spaces that all reference the same index with an index pattern - metricbeat-*./

Metricbeat comes with MANY *.pct fields and I'd like to display them all as percentages rather than numbers. It would take a lot of time for me to go into each of my 20 spaces and adjust the individual dataviews/index patterns to the correct format of percentage. So, is there a way I can do this with an index template or some other scalable way? If not this would be an incredible enhancement.

Not via Elasticsearch, as it'll be stored as a number of some sort, and not a percentage.

Opening a request in the Kibana repo would probably be the best place, as it could definitely recognise the use of .pct and then display it accordingly.

@seanziee What version are you on? And when you say Display you mean in Discover or all Visualizations or both?

I ask because in 8.x percentages are shown as percentages... in Discover and Lens and TSVB Visualization OOTB as far as I can tell. Lens and TSVB do this auto as well.
Perhaps I am missing something.

If you are in 7.x you can actually set them on an index pattern then important that index pattern into other spaces ... a bit painful but can be done I believe.

1 Like

I can def. make a request on kibana repo. I'm using 7.17.4 right now, is there a newer version where this is possible?

Yes starting in 8.0.0 which is literally the next / newer version.
the 7.x version are no longer under active development 7.17.4 would be the last release unless a security issue / bad bug that needs to be back ported.

@stephenb , could you point me to the documentation that indicates how to do it?

@seanziee You mean how to do it in 7.17?

No i mean in version 8.x

It's automatic in 8.x...

Those screen shots are default behavior... For the ECS fields

Are you seeing something different?

Those are Data Views

Are you referring to your own custom fields?

Ok so by default in 8.X, any field that ends with .pct will be mapped as a percent?

And if I did happen to want to do it with a custom field, is there a way to do that in a template or something similar?

No not what I meant, I mean all the .pct fields that are part of metricbeat modules / ECS fields have the format type set to percent as part of the default setup.

Quick count 274 Fields are marked with "percent format" so all those are done.

If you create additional fields you will need to set the format to Percentage via the UI or API... Then Copy that updated Data View to your new Space.. via the UI or API.

You can see this by going through the UI or looking at them via the API.

UI

API

...
			"system.cpu.total.norm.pct": {
				"count": 0,
				"name": "system.cpu.total.norm.pct",
				"type": "number",
				"esTypes": [
					"scaled_float"
				],
				"scripted": false,
				"searchable": true,
				"aggregatable": true,
				"readFromDocValues": true,
				"format": {
					"id": "percent" <!--- HERE
				},
				"shortDotsEnable": false,
				"isMapped": true
			},
...