Elasticsearch error: Fielddata is disabled on text fields by default

hi all,
I have a field as PFiled which its format is as following:
it is not a date field, but elasticsearch defined its mapping as date which is wrong. I define template to set it as text as following:

PUT _template/template1
"index_patterns" : [
"mappings" : {
      "doc" : {
        "properties" : {
          "PField" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
            }          }


running above command in dev tools, leads to following error:

failed to execute fetch phase
org.elasticsearch.transport.RemoteTransportException: [node-SRV123][localhost:9300][indices:data/read/search[phase/fetch/id]]
Caused by: java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [PField] 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.

there are many other text fields which elasticsearch defined them as text by default; there is no issue in the case of that fields, but when i defined PField as a text field this message has been found in the log. how can i handle this issue? this field cannot be configured as Date because it is not Date and defining text type leads to above error. could you please advise me about this?


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