# Converting from single index to index per time frame schema

**URL:** <https://discuss.elastic.co/t/converting-from-single-index-to-index-per-time-frame-schema/138001>\
**Category:** Elasticsearch\
**Created:** [June 29, 2018, 3:36pm UTC](https://discuss.elastic.co/t/converting-from-single-index-to-index-per-time-frame-schema/138001 "2018-06-29T15:36:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![veerabhadraiah](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@veerabhadraiah](https://discuss.elastic.co/u/veerabhadraiah)\
**Post date:** [June 29, 2018, 3:36pm UTC](https://discuss.elastic.co/t/converting-from-single-index-to-index-per-time-frame-schema/138001/1 "2018-06-29T15:36:16Z")

</div>

Hi,

Please help me to continue

We get around 30 million records per day in our database server. Presently, we were saving this data in a single index. As data keeps growing, now we are now facing slowness and memory full issues whenever we try to search something from the index. Hence, I wanted to move from single index to index per time frame.

My present index schema is

```auto
PUT event
{
                    "settings": {
                        "analysis": {
                            "normalizer": {
                                "lc_normalizer": {
                                "type": "custom",
                                "char_filter": [],
                                "filter": ["lowercase", "asciifolding"]
                                }
                            }
                        }
                    },
                    "mappings": {
                            "events": {
                            "properties": {
                                "idx": { "type": "keyword","index" : "true" },
                                "scrip": { "type": "integer", "index" : "true" },
                                "entered": { "type": "date" , "index" : "true" , "format": "strict_date_optional_time||epoch_millis" },
                                "enteredDate": { "type": "keyword" , "index" : "true"},
                                "serverDate": { "type": "keyword" , "index" : "true"},
                                "customer": { "type": "keyword", "index" : "true" },
                                "machine": { "type": "keyword", "index" : "true" }
                            }
                        }
                    }
                }

```

Please suggest how to create schema in elastic search to achieve index per time frame.

I have written a code using nested type and in this one I want to save each day's data in a nested block. Let me know if this a correct way.

```auto
PUT event_june
{
	"settings": {
		"analysis": {
			"normalizer": {
				"lc_normalizer": {
					"type": "custom",
					"char_filter": [],
					"filter": ["lowercase", "asciifolding"]
				}
			}
		}
	},
	"mappings": {
		"events": {
			"properties": {
				"29062018": {
					"type": "nested",
					"properties": {
						"idx": {"type": "keyword","index": "true"},
						"scrip": {"type": "integer","index": "true"},
						"entered": {"type": "date","index": "true","format": "strict_date_optional_time||epoch_millis"},
						"customer": {"type": "keyword","index": "true"},
						"machine": {"type": "keyword","index": "true"},
					}
				},
				"30062018": {
					"type": "nested",
					"properties": {
						"idx": {"type": "keyword","index": "true"},
						"scrip": {"type": "integer","index": "true"},
						"entered": {"type": "date","index": "true","format": "strict_date_optional_time||epoch_millis"},
						"customer": {"type": "keyword","index": "true"},
						"machine": {"type": "keyword","index": "true"},
					}
				}
			}
		}
	}
}

```

---

<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 27, 2018, 3:36pm UTC](https://discuss.elastic.co/t/converting-from-single-index-to-index-per-time-frame-schema/138001/2 "2018-07-27T15:36:19Z")

</div>

Closed on July 27, 2018, 3:36pm UTC

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