# Fielddata is disabled on text fields by default. Set fielddata=true on \[host.name\] in order to load fielddata in memory by uninverting the inverted index

**URL:** <https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 17, 2019, 7:56am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111 "2019-12-17T07:56:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![skdasari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skdasari/32/50452_2.png) [@skdasari](https://discuss.elastic.co/u/skdasari)\
**Post date:** [December 17, 2019, 7:56am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111/1 "2019-12-17T07:56:09Z")

</div>

Hello,

Something weird happend lately in my elasticsearch setup letely. Metricbeat index got replaced with a new name like the old one is like metricbeat.x.date, But now the index is showing as metricbeat .version and when trying to visualize. I am getting the bellow error.

Error:

[esaggs] \> Request to Elasticsearch failed: {"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [host.name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}],"type":"search\_phase\_execution\_exception","reason":"all shards failed","phase":"query","grouped":true,"failed\_shards":[{"shard":0,"index":"metricbeat-7.2.1","node":"iD4ffU\_sR2-uLU\_SP01Ukw","reason":{"type":"illegal\_argument\_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [host.name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}],"caused\_by":{"type":"illegal\_argument\_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [host.name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.","caused\_by":{"type":"illegal\_argument\_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [host.name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}},"status":400}

Tried solutions:

Provided the following in console.

PUT my\_index/\_doc/host.name.keyword  
{  
"properties": {  
"my\_field": {  
"type": "text",  
"fielddata": true  
}  
}  
}

output:  
{  
"\_index" : "my\_index",  
"\_type" : "\_doc",  
"\_id" : "host.name",  
"\_version" : 1,  
"\_seq\_no" : 0,  
"\_primary\_term" : 1,  
"found" : true,  
"\_source" : {  
"properties" : {  
"my\_field" : {  
"type" : "text",  
"fielddata" : true  
}  
}  
}  
}

And also

PUT my\_index/\_doc/host.name  
{  
"properties": {  
"my\_field": {  
"type": "text",  
"fielddata": true  
}  
}  
}

Output:  
{  
"\_index" : "my\_index",  
"\_type" : "\_doc",  
"\_id" : "host.name",  
"\_version" : 2,  
"result" : "updated",  
"\_shards" : {  
"total" : 2,  
"successful" : 1,  
"failed" : 0  
},  
"\_seq\_no" : 2,  
"\_primary\_term" : 2  
}

Can any one help me out on my issue.

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [December 17, 2019, 5:08pm UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111/2 "2019-12-17T17:08:29Z")

</div>

Hi @skdasari,

Could you tell a little bit more about your deployment?

Was it a new deployment or an existing one? Did it happen after an upgrade?

This kind of errors use to happen when there is some kind of issue with index mapping. Did you run the [Metricbeat setup](https://www.elastic.co/guide/en/beats/metricbeat/7.5/metricbeat-template.html)?

---

<div class="post-metadata">

**Author:** ![skdasari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skdasari/32/50452_2.png) [@skdasari](https://discuss.elastic.co/u/skdasari)\
**Post date:** [December 18, 2019, 6:42am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111/3 "2019-12-18T06:42:19Z")

</div>

I think it might be an issue with the index mapping recently I have setup a lifecycle policy for the metricbeat index as it has like one month hot phase by default. I set it to one week and then applied delete phase to the policy. After this the index got messed up showing this error. Not sure what to do here because even after deleting the exxisting index the newly formed index is also giving the same error

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [December 18, 2019, 12:01pm UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111/4 "2019-12-18T12:01:51Z")

</div>

When beats use [ILM](https://www.elastic.co/guide/en/beats/metricbeat/7.5/ilm.html) (as is the default since 7.0), they write to an index alias, usually `<beat name>-<version>`, that points to a real index that uses to contain in its name the date of creation.  
If you remove the alias while the beat is running, it will continue writing to `<beat name>-<version>`. As it won't exist, Elasticsearch will create a new index without mapping, that could cause issues like the ones you are experiencing.  
To confirm that, check if you have ILM enabled, and if `metricbeat-<version>` is an alias or an actual index.

To solve this, you should stop all Metricbeat instances that are writing to the index `metricbeat-<version>`, then remove or rename this index, and then start Metricbeat again. When Metricbeat starts it creates all the indexes and ILM configurations it needs if they don't already exist.

---

<div class="post-metadata">

**Author:** ![skdasari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skdasari/32/50452_2.png) [@skdasari](https://discuss.elastic.co/u/skdasari)\
**Post date:** [December 20, 2019, 8:57am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111/5 "2019-12-20T08:57:26Z")

</div>

@jsoriano

Sure I will try to do this because whatever I try it's showing the same error.

Thanks,  
Dasari.

---

<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:** [January 17, 2020, 8:57am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields-by-default-set-fielddata-true-on-host-name-in-order-to-load-fielddata-in-memory-by-uninverting-the-inverted-index/212111/6 "2020-01-17T08:57:28Z")

</div>

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