# Enabling Fielddata for all fields in all documents of all indices

**URL:** https://discuss.elastic.co/t/enabling-fielddata-for-all-fields-in-all-documents-of-all-indices/167500
**Category:** Elasticsearch
**Created:** [February 7, 2019, 6:12pm UTC](https://discuss.elastic.co/t/enabling-fielddata-for-all-fields-in-all-documents-of-all-indices/167500 "2019-02-07T18:12:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hasherbaba](https://avatars.discourse-cdn.com/v4/letter/h/dfb087/32.png) [@hasherbaba](https://discuss.elastic.co/u/hasherbaba)
#### Post date: [February 7, 2019, 6:12pm UTC](https://discuss.elastic.co/t/enabling-fielddata-for-all-fields-in-all-documents-of-all-indices/167500/1 "2019-02-07T18:12:40Z")

</div>

I have an elasticsearch query which fails when executed via Node app within a kubernetes pod.

Query:

```
"size":9999,"aggs":{"x":{"terms":{"field":"c_5.number","size":9999,"missing":"-99"},"aggs":{"y1a":{"filter":{"bool":{"must":[{"term":{"c_101.raw":"Pakka"}}]}},"aggs":{"value":{"value_count":{"field":"c_101.raw"}}}},"y1b":{"value_count":{"field":"c_17.raw"}},"y1":{"bucket_script":{"buckets_path":{"a":"y1a.value","b":"y1b"},"script":"(params.a*100)/params.b"}}}}},"query":{"bool":{"must":[{"bool":{"should":[]}},{"bool":{"must":[]}},{"bool":{"must_not":[]}},{"bool":{"filter":[]}}]}}}'

```

Error:

```
body: '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [c_101.raw] 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":"d6c89881f9b104c94232777f1fd5e64e27ab1843","node":"ivgn9VOcTP6go8NvC3mnMA","reason":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [c_101.raw] 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}' } {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [c_101.raw] 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":"d6c89881f9b104c94232777f1fd5e64e27ab1843","node":"ivgn9VOcTP6go8NvC3mnMA","reason":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [c_101.raw] 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}

```

When I throw a curl request, I get the desired output:

```
curl -XGET http://localhost:9200/d6c89881f9b104c94232777f1fd5e64e27ab1843/latest/_search -d'
{"size":9999,"aggs":{"x":{"terms":{"field":"c_5.number","size":9999,"missing":"-99"},"aggs":{"y1a":{"filter":{"bool":{"must":[{"term":{"c_101.raw":"Pakka"}}]}},"aggs":{"value":{"value_count":{"field":"c_101.raw"}}}},"y1b":{"value_count":{"field":"c_17.raw"}},"y1":{"bucket_script":{"buckets_path":{"a":"y1a.value","b":"y1b"},"script":"(params.a*100)/params.b"}}}}},"query":{"bool":{"must":[{"bool":{"should":[]}},{"bool":{"must":[]}},{"bool":{"must_not":[]}},{"bool":{"filter":[]}}]}}}'

```

I have been able to run the above query from my remote machine as well, so yes, ES is available to the apps other than `localhost` network.

Although, I have read about the fieldData enabling but I don't think that is the reason because had it been the case, I could not even run a curl request(I think).

The ES Version is:

```auto
{
  "name" : "es-production",
  "cluster_name" : "production",
  "cluster_uuid" : "Gauczb84S-CvH4LNa4JxeQ",
  "version" : {
    "number" : "5.6.4",
    "build_hash" : "8bbedf5",
    "build_date" : "2017-10-31T18:55:38.105Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.1"
  },
  "tagline" : "You Know, for Search"
}

```

---

<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: [March 7, 2019, 6:19pm UTC](https://discuss.elastic.co/t/enabling-fielddata-for-all-fields-in-all-documents-of-all-indices/167500/2 "2019-03-07T18:19:09Z")

</div>

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