# How to set timezone on index using rest-api

**URL:** <https://discuss.elastic.co/t/how-to-set-timezone-on-index-using-rest-api/157007>\
**Category:** Elasticsearch\
**Created:** [November 16, 2018, 8:19am UTC](https://discuss.elastic.co/t/how-to-set-timezone-on-index-using-rest-api/157007 "2018-11-16T08:19:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mortenb123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenb123/32/37227_2.png) [@mortenb123](https://discuss.elastic.co/u/mortenb123)\
**Post date:** [November 16, 2018, 8:19am UTC](https://discuss.elastic.co/t/how-to-set-timezone-on-index-using-rest-api/157007/1 "2018-11-16T08:19:51Z")

</div>

I try to set the timezone on the @timestamp index as we do in logstash:

```
20181116091132.106 - root:139 - ERROR - put index 'proxylogs-mb-pc-2018-10-16' with data:'{
    "mappings": {
        "proxylog": {
            "properties": {
                "@timestamp": {
                    "type": "date",
                    "format": "yyyy-MM-dd HH:mm:ss.SSS",
                    "timezone": "Europe/Oslo"
                },
                "host": {
                    "type": "text"
                },
                "loglevel": {
                    "type": "text"
                },
                "message": {
                    "type": "text"
                },
                "operationId": {
                    "type": "text"
                },
                "tags": {
                    "type": "text"
                },
                "id": {
                    "type": "long"
                }
            }
        }
    },
    "settings": {
        "number_of_shards": "3",
        "number_of_replicas": "1"
    }
    }' returned: {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [@timestamp] has unsupported parameters: [timezone : Europe/Oslo]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [proxylog]: Mapping definition for [@timestamp] has unsupported parameters: [timezone : Europe/Oslo]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [@timestamp] has unsupported parameters: [timezone : Europe/Oslo]"}},"status":400}
```

---

<div class="post-metadata">

**Author:** ![mortenb123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenb123/32/37227_2.png) [@mortenb123](https://discuss.elastic.co/u/mortenb123)\
**Post date:** [November 16, 2018, 8:47am UTC](https://discuss.elastic.co/t/how-to-set-timezone-on-index-using-rest-api/157007/2 "2018-11-16T08:47:54Z")

</div>

Since data was in 'Europe/Oslo' Timezone, I just added '+0100' to the end so it converts i properly to UTC

```auto
"format": "yyyy-MM-dd HH:mm:ss.SSSZ"

```

I do not have time to do proper timestamp conversion since I need to insert more than 4000/sec

---

<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:** [December 14, 2018, 8:47am UTC](https://discuss.elastic.co/t/how-to-set-timezone-on-index-using-rest-api/157007/3 "2018-12-14T08:47:56Z")

</div>

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