# Is there any way to make a 'string' .raw for a 'date' type?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-make-a-string-raw-for-a-date-type/72332>\
**Category:** Elasticsearch\
**Created:** [January 20, 2017, 8:28pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-make-a-string-raw-for-a-date-type/72332 "2017-01-20T20:28:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xlbrlx](https://avatars.discourse-cdn.com/v4/letter/x/7ab992/32.png) [@xlbrlx](https://discuss.elastic.co/u/xlbrlx)\
**Post date:** [January 20, 2017, 8:28pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-make-a-string-raw-for-a-date-type/72332/1 "2017-01-20T20:28:36Z")

</div>

this does not seem to work:

```
"myDate": {
                            "type": "date",
                            "format": " yyyy-MM-dd || yyyy-MM || Y ||date_hour_minute_second",
                            "fields": {
                                "raw": {
                                    "type": "string",
                                    "index": "not_analyzed",
                                    "null_value": "",
                                    "doc_values": true
                                }
                            }
                        }
```

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [January 24, 2017, 11:31pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-make-a-string-raw-for-a-date-type/72332/2 "2017-01-24T23:31:53Z")

</div>

You could set up a `copy_to` parameter in the `myDate` field that copied the field to a different field, which you can make unanalyzed.

---

<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:** [February 21, 2017, 11:32pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-make-a-string-raw-for-a-date-type/72332/3 "2017-02-21T23:32:06Z")

</div>

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