# Can not reduce index size in elasticsearch

**URL:** <https://discuss.elastic.co/t/can-not-reduce-index-size-in-elasticsearch/85738>\
**Category:** Elasticsearch\
**Created:** [May 15, 2017, 10:23am UTC](https://discuss.elastic.co/t/can-not-reduce-index-size-in-elasticsearch/85738 "2017-05-15T10:23:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hanks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanks/32/18204_2.png) [@hanks](https://discuss.elastic.co/u/hanks)\
**Post date:** [May 15, 2017, 10:23am UTC](https://discuss.elastic.co/t/can-not-reduce-index-size-in-elasticsearch/85738/1 "2017-05-15T10:23:29Z")

</div>

Version: Elasticsearch 5.4

Hi, I am a new comer to elasticsearch , and use it to analyze my nginx access log, before I use the default mapping template, and now I want to reduce index size followed by some rules below:

- disable `_all` field
- remove `text` mapping, and only map `keyword` type for all the string fileds

Then I update the index template, use `reindex` API to create a new index, the result is that the mapped fields are decreased, but the index size is increased. I can not tell this reason. How to reduce the size of my index correctly? Thank you for your time.

Here is my template

```auto
{
  "template": "*nginx*",
  "aliases": {},
  "mappings": {
    "_default_": {
      "properties": {
        "@version": {
          "type": "keyword",
          "include_in_all": false
        },
        "geoip": {
          "properties": {
            "longitude": {
              "type": "half_float"
            },
            "location": {
              "type": "geo_point"
            },
            "latitude": {
              "type": "half_float"
            },
            "ip": {
              "type": "ip"
            }
          },
          "dynamic": true
        },
        "@timestamp": {
          "type": "date",
          "include_in_all": false
        }
      },
      "_all": {
        "enabled": false
      },
      "dynamic_templates": [
        {
          "string_fields": {
            "match_mapping_type": "string",
            "mapping": {
              "type": "keyword",
              "norms": false
            }
          }
        }
      ]
    }
  },
  "settings": {
    "index": {
      "refresh_interval": "30s"
    }
  },
  "version": 1,
  "order": 0
}

```

And the diff to the default one is

```auto
...
"dynamic_templates": [
          {
            "message_field": {
              "mapping": {
                "type": "text",
                "norms": false
              },
              "match_mapping_type": "string",
              "path_match": "message"
            }
          },
          {
            "string_fields": {
              "mapping": {
                "type": "text",
                "norms": false,
                "fields": {
                  "keyword": {
                    "type": "keyword"
                  }
                }
              },
              "match_mapping_type": "string",
              "match": "*"
            }
          }
        ],
        "_all": {
          "norms": false,
          "enabled": true
        }
...

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 15, 2017, 10:28am UTC](https://discuss.elastic.co/t/can-not-reduce-index-size-in-elasticsearch/85738/2 "2017-05-15T10:28:39Z")

</div>

> [@hanks](#):
>
> but the index size is increased

How are you telling this?

---

<div class="post-metadata">

**Author:** ![hanks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hanks/32/18204_2.png) [@hanks](https://discuss.elastic.co/u/hanks)\
**Post date:** [May 15, 2017, 12:26pm UTC](https://discuss.elastic.co/t/can-not-reduce-index-size-in-elasticsearch/85738/3 "2017-05-15T12:26:58Z")

</div>

Thank you for you reply, I use '\_cat/indices' to check the docs size between old and new index

---

<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:** [June 12, 2017, 12:40pm UTC](https://discuss.elastic.co/t/can-not-reduce-index-size-in-elasticsearch/85738/4 "2017-06-12T12:40:11Z")

</div>

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