# Setting date field as doc\_value and not fielddata is overriden

**URL:** <https://discuss.elastic.co/t/setting-date-field-as-doc-value-and-not-fielddata-is-overriden/34305>\
**Category:** Elasticsearch\
**Created:** [November 11, 2015, 8:15am UTC](https://discuss.elastic.co/t/setting-date-field-as-doc-value-and-not-fielddata-is-overriden/34305 "2015-11-11T08:15:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EyalHei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyalhei/32/5840_2.png) [@EyalHei](https://discuss.elastic.co/u/EyalHei)\
**Post date:** [November 11, 2015, 8:15am UTC](https://discuss.elastic.co/t/setting-date-field-as-doc-value-and-not-fielddata-is-overriden/34305/1 "2015-11-11T08:15:41Z")

</div>

I asked this question on SO as well, as I didn't know about this forum.

I'm new to ElasticSearch, started working with ElasticSearch 1.7.3 as part of a Logstash-ElasticSearch-Kibana deployment.

I've defined a mapping template for my log messages, this is the interesting part:

```
{   
  "template" : "logstash-*",
  "settings" : { "index.refresh_interval" : "5s" },
  "mappings" : {
    "_default_" : {
      "_all" : {"enabled" : true, "omit_norms" : true},
      "dynamic_templates" : [ {
        "date_fields" : {
          "match" : "*",
          "match_mapping_type" : "date",
          "mapping" : { "type" : "date", "doc_values" : true }
        }
      }],
      "properties" : {
        "@version" : { "type" : "string", "index" : "not_analyzed" },
        "@timestamp" : { "type" : "date", "format" : "dateOptionalTime" },
        "message" : { "type" : "string" }
      }
    } , 
    "my_log" : {
      "_all" : { "enabled" : true, "omit_norms" : true },
      "dynamic_templates" : [ {
        "date_fields" : {
          "match" : "*",
          "match_mapping_type" : "date",
          "mapping" : { "type" : "date", "doc_values" : true }
        }
      }],
      "properties" : {
        "@timestamp" : { "type" : "date", "format" : "dateOptionalTime" },
        "file" : { "type" : "string" },
        "message" : { "type" : "string" }
        "geolocation" : { "type" : "string" },
      }
    }
  }
}

```

Although the @timestamp field is defined as doc\_value:true I have an error of MemoryException because it is a fielddata:  
[FIELDDATA] Data too large, data for [@timestamp] would be larger than limit of [633785548/604.4 mb]

**I dont understand why my @timestamp is treated as FIELDDATA when I defined all time "date fields" to be doc\_values?**

I know I can change the memory or add more nodes to the cluster, but in my point of view this is a design problem where this field should not be indexed in memory.

---

<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:** [July 5, 2017, 11:39pm UTC](https://discuss.elastic.co/t/setting-date-field-as-doc-value-and-not-fielddata-is-overriden/34305/2 "2017-07-05T23:39:18Z")

</div>


