# Set data view format in index template

**URL:** https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445
**Category:** Elasticsearch
**Created:** [June 16, 2022, 7:23pm UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445 "2022-06-16T19:23:34Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)
#### Post date: [June 16, 2022, 7:23pm UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/1 "2022-06-16T19:23:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [June 20, 2022, 12:57am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/2 "2022-06-20T00:57:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 20, 2022, 1:35am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/3 "2022-06-20T01:35:11Z")

</div>

@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.

 ![Screen Shot 2022-06-19 at 7.11.07 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/c/1c1a67e51504a91ce8da75f5944c1c36d57d74d6.png)

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.

---

<div class="post-metadata">

### Author: ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)
#### Post date: [June 20, 2022, 8:04am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/4 "2022-06-20T08:04:15Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 20, 2022, 2:10pm UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/5 "2022-06-20T14:10:16Z")

</div>

> [@seanziee](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)
#### Post date: [June 22, 2022, 1:55am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/6 "2022-06-22T01:55:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 22, 2022, 2:25am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/7 "2022-06-22T02:25:37Z")

</div>

@seanziee You mean how to do it in 7.17?

---

<div class="post-metadata">

### Author: ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)
#### Post date: [June 22, 2022, 2:48am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/8 "2022-06-22T02:48:08Z")

</div>

No i mean in version 8.x

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 22, 2022, 3:27am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/9 "2022-06-22T03:27:16Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)
#### Post date: [June 24, 2022, 9:32pm UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/10 "2022-06-24T21:32:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [June 25, 2022, 1:40am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/11 "2022-06-25T01:40:06Z")

</div>

> [@seanziee](#):
>
> Ok so by default in 8.X, any field that ends with `.pct` will be mapped as a percent?

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

 ![Screen Shot 2022-06-24 at 6.34.10 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/e/1e7ee168a5bea5b99e85f6decca26402fc368b41.jpeg)

API

```auto
...
			"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
			},
...

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 23, 2022, 1:40am UTC](https://discuss.elastic.co/t/set-data-view-format-in-index-template/307445/12 "2022-07-23T01:40:13Z")

</div>

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