# Setting a default value for missing fields during indexing or reindexing

**URL:** <https://discuss.elastic.co/t/setting-a-default-value-for-missing-fields-during-indexing-or-reindexing/201908>\
**Category:** Elasticsearch\
**Created:** [October 2, 2019, 8:43am UTC](https://discuss.elastic.co/t/setting-a-default-value-for-missing-fields-during-indexing-or-reindexing/201908 "2019-10-02T08:43:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Choudhury](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_choudhury/32/55220_2.png) [@Rahul\_Choudhury](https://discuss.elastic.co/u/Rahul_Choudhury)\
**Post date:** [October 2, 2019, 8:43am UTC](https://discuss.elastic.co/t/setting-a-default-value-for-missing-fields-during-indexing-or-reindexing/201908/1 "2019-10-02T08:43:34Z")

</div>

I am trying to create an elastic search mapping where during indexing of data if a field is missing it should add some default value.

PUT my\_index

```auto
{
  "mappings": {
    "_doc": {
      "properties": {
        "status_code": {
          "type": "keyword"
        },
        "response": {
          "type": "string"
        }
      }
    }
  }
}

```

PUT my\_index/doc/1

```auto
{ "statuscode": "200" }

```

So, as in the above example response field is missing , is it possible to add some default value during indexing for response.?

---

<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:** [October 30, 2019, 8:48am UTC](https://discuss.elastic.co/t/setting-a-default-value-for-missing-fields-during-indexing-or-reindexing/201908/2 "2019-10-30T08:48:12Z")

</div>

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