Enabling Fielddata for all fields in all documents of all indices

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:

{
  "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"
}

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