# Fielddata is disabled on text fields

**URL:** <https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793>\
**Category:** Elasticsearch\
**Created:** [August 19, 2019, 6:18pm UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793 "2019-08-19T18:18:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwalls](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jwalls](https://discuss.elastic.co/u/jwalls)\
**Post date:** [August 19, 2019, 6:18pm UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793/1 "2019-08-19T18:18:57Z")

</div>

So an error I'm receiving for `"logstash-2019.08.19"` is `"Fielddata is disabled on text fields by default. Set fielddata=true on [time] 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."`

However, I use "time" as a `date` datatype. Is there something about the `date` type that is treated as a `text` type?

```auto
  "template": "logstash-*",
  "order": 1, 
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1
  },
  "mappings": 
  {
    "syslog": 
    {
      "properties": 
      {
        "time": {
          "type": "date",
          "format": "basic_time_no_millis"
        },
        "before": {
          "type": "date",
          "format": "strict_date_time"
        },
        "after": {
          "type": "date",
          "format": "strict_date_time"
        },
        "logsource": {
          "type": "ip"
        }
      }
    } 
  }

```

simply enabling `fielddata` on "time" does not resolve the error.

---

<div class="post-metadata">

**Author:** ![jwalls](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jwalls](https://discuss.elastic.co/u/jwalls)\
**Post date:** [August 19, 2019, 10:00pm UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793/2 "2019-08-19T22:00:53Z")

</div>

checking the mapping for the index shows the following for "time":

```auto
"time" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },

```

so i have the proper unanalyzed keyword field set, yet the error persists.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 20, 2019, 7:22am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793/3 "2019-08-20T07:22:14Z")

</div>

Hey,

instead of enabling fielddata, you can just use `time.keyword` in this case. However I am wondering why time is a string based field here....

--Alex

---

<div class="post-metadata">

**Author:** ![jwalls](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@jwalls](https://discuss.elastic.co/u/jwalls)\
**Post date:** [August 20, 2019, 9:47pm UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793/4 "2019-08-20T21:47:39Z")

</div>

In the conf file i explicitly add time as such

```auto
 add_field => {
      "time" => "%{+HHmmssZ}"
      "weekday" => "%{+EEE}"
    }

```

could it be that this is not within the dynamic template's date detection list? That format, of time with no milliseconds seemed valid to me, yet it seems that even tho i specify time as a type `date` it responds with a type `text`

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 21, 2019, 6:38am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793/5 "2019-08-21T06:38:07Z")

</div>

this only looks like a time without a date, so it is hard to infer a date out of that - which then makes perfect sense that it is parsed as text unless specifically configured in the mapping.

---

<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:** [September 18, 2019, 6:38am UTC](https://discuss.elastic.co/t/fielddata-is-disabled-on-text-fields/195793/6 "2019-09-18T06:38:10Z")

</div>

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