# Cost of storing duplicate fields, but not indexing the duplicated field via \_dynamic=false

**URL:** <https://discuss.elastic.co/t/cost-of-storing-duplicate-fields-but-not-indexing-the-duplicated-field-via-dynamic-false/207880>\
**Category:** Elasticsearch\
**Created:** [November 14, 2019, 12:05pm UTC](https://discuss.elastic.co/t/cost-of-storing-duplicate-fields-but-not-indexing-the-duplicated-field-via-dynamic-false/207880 "2019-11-14T12:05:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harsimranb](https://avatars.discourse-cdn.com/v4/letter/h/a6a055/32.png) [@harsimranb](https://discuss.elastic.co/u/harsimranb)\
**Post date:** [November 14, 2019, 12:05pm UTC](https://discuss.elastic.co/t/cost-of-storing-duplicate-fields-but-not-indexing-the-duplicated-field-via-dynamic-false/207880/1 "2019-11-14T12:05:09Z")

</div>

Hi, I am storing duplicate fields in my document (solution to an interesting use case). Using, `_dynamic=false`, I am only indexing the one set of fields, not the duplicate ones. This helps keep my index small, but our \_source is storing the duplicate data. My question is, what is the storage cost of this approach? If I'm concerned about disk usage, am I saving a ton by not indexing the duplicate fields? Is storing the duplicate fields a problem in any way? (Aside from the questionable use itself)?

What I originally wanted to do was, set the index field name to be the duplicate field name, but keep the original field name in the `_source`. For example, in the example below, Text\_1, Num\_1, and TextLong\_1 in the index store \_source.name, age, and description, respectively. But the field names are different between index and \_source. The only way to do this, it seems, is with field alias, which we've investigated, and it does not git with what we're trying to do.

## Example

**Index:**

```
{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "dynamic": false,
        "properties" : {
            "Text_1" : { "type" : "text" },
            "TextLong_1" : { "type" : "text" },
            "Num_1" : { "type" : "integer" }
        }
    }
}

```

**Index Document in Elastic Search**

```
{
  "DocType": "Doc1",
  "name" : "my name goes here",
  "Text_1" : "my name goes here",
  "age": 21,
  "Num_1": 21,
  "description": "Doc 1 description, age is 21"
  "TextLong_1": "Doc 1 description, age is 21"
}

```

**Retrieve Document from Index**

```
{ 
   "_index":"fieldtestdynamic",
   "_type":"_doc",
   "_id":"1",
   "_version":1,
   "_seq_no":0,
   "_primary_term":2,
   "found":true,
   "_source":{ 
      "Text_1":"my name goes here", **# Indexed**
      "TextLong_1":"Doc 1 description, age is 21", **# Indexed**
      "Num_1":21, **# Indexed**
      "DocType":"Doc1", **# Indexed**
      "name":"my name goes here",
      "description":"Doc 1 description, age is 21",
      "age":21
   }
}
```

---

<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 12, 2019, 12:05pm UTC](https://discuss.elastic.co/t/cost-of-storing-duplicate-fields-but-not-indexing-the-duplicated-field-via-dynamic-false/207880/2 "2019-12-12T12:05:10Z")

</div>

Closed on December 12, 2019, 12:05pm UTC

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