# Adding new field to existing index in ES 5.6

**URL:** <https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854>\
**Category:** Elasticsearch\
**Created:** [January 10, 2018, 11:50am UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854 "2018-01-10T11:50:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sridhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sridhar/32/64860_2.png) [@Sridhar](https://discuss.elastic.co/u/Sridhar)\
**Post date:** [January 10, 2018, 11:50am UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/1 "2018-01-10T11:50:00Z")

</div>

Hi,

I have created a index with 3 field using CSV files.  
Now I want to add another 2 fields in to the index is this possible?

current fields  
date, country, customer, count.

new fields  
date, country, customer, under\_tshold, count, tshold.

can anyone help here?

thanks,  
Sridhar. B

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 10, 2018, 1:21pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/2 "2018-01-10T13:21:35Z")

</div>

Yes it's possible.

---

<div class="post-metadata">

**Author:** ![Fram\_Souza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fram_souza/32/24833_2.png) [@Fram\_Souza](https://discuss.elastic.co/u/Fram_Souza)\
**Post date:** [January 10, 2018, 7:43pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/3 "2018-01-10T19:43:37Z")

</div>

Hi @Sridhar

You can do this to add for example, a field "date" in existing doc:

POST nameindex/typeindex/docindex/\_update?pretty  
{  
"doc": {  
"date" : "2017/01/10"  
}

---

<div class="post-metadata">

**Author:** ![Sridhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sridhar/32/64860_2.png) [@Sridhar](https://discuss.elastic.co/u/Sridhar)\
**Post date:** [January 11, 2018, 3:29pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/4 "2018-01-11T15:29:35Z")

</div>

Hi,

can you help me how to find this typeindex and docindex?

I'm very new to elastic search.

I want to one the field with data [value] to it.

Thanks,  
Sridhar. B

---

<div class="post-metadata">

**Author:** ![Sridhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sridhar/32/64860_2.png) [@Sridhar](https://discuss.elastic.co/u/Sridhar)\
**Post date:** [January 11, 2018, 3:35pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/5 "2018-01-11T15:35:48Z")

</div>

Hi,

below is the actual example.

**current data in ElasticSearch:**

```
    "_index": "test",
    "_type": "logs",
    "_id": "AWDgIKFCvg3odC71dRbc",
    "_score": 0.09685399,
    "_source": {
      "HighTH": 120000,
      "@timestamp": "2018-01-10T12:52:02.684Z",
      "Cust": 16926,
      "application": "myapps",
      "@version": "1",
      "host": "localhost",
      "Run_date": "2018-01-03T16:00:00.000Z",
      "LowTH": 10000,
      "message": "04-JAN-2018,MN,16926,206472,15785,120000,10000",
      "Trans": 206472,
      "Cntry_code": "NO",
      "Trans_GPS": 15785
    }

```

**want to update new like this..** [added mkvalue: 209845] in below example.

```
    "_index": "test",
    "_type": "logs",
    "_id": "AWDgIKFCvg3odC71dRbc",
    "_score": 0.09685399,
    "_source": {
      "HighTH": 120000,
      "@timestamp": "2018-01-10T12:52:02.684Z",
      "Cust": 16926,
      "application": "myapps",
      "@version": "1",
      "host": "localhost",
      "Run_date": "2018-01-03T16:00:00.000Z",
      "LowTH": 10000,
      "message": "04-JAN-2018,MN,16926,206472,15785,120000,10000",
      "Trans": 206472,
      "Cntry_code": "NO",
      "Trans_GPS": 15785,
      "mkValue": 209845

```

}

how to update this "mkvalue" in Elastic search in test index with value 209845 ??

thanks,  
Sridhar. B

---

<div class="post-metadata">

**Author:** ![Fram\_Souza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fram_souza/32/24833_2.png) [@Fram\_Souza](https://discuss.elastic.co/u/Fram_Souza)\
**Post date:** [January 11, 2018, 3:51pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/6 "2018-01-11T15:51:22Z")

</div>

Hi!

POST test/logs/AWDgIKFCvg3odC71dRbc/\_update?pretty  
{  
"doc": {  
"mkvalue" : "209845"  
}

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 11, 2018, 6:04pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/7 "2018-01-11T18:04:35Z")

</div>

Even better is to do:

```auto
PUT test/logs/AWDgIKFCvg3odC71dRbc
{
      "HighTH": 120000,
      "@timestamp": "2018-01-10T12:52:02.684Z",
      "Cust": 16926,
      "application": "myapps",
      "@version": "1",
      "host": "localhost",
      "Run_date": "2018-01-03T16:00:00.000Z",
      "LowTH": 10000,
      "message": "04-JAN-2018,MN,16926,206472,15785,120000,10000",
      "Trans": 206472,
      "Cntry_code": "NO",
      "Trans_GPS": 15785,
      "mkValue": 209845
}

```

---

<div class="post-metadata">

**Author:** ![Fram\_Souza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fram_souza/32/24833_2.png) [@Fram\_Souza](https://discuss.elastic.co/u/Fram_Souza)\
**Post date:** [January 12, 2018, 12:24pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/8 "2018-01-12T12:24:26Z")

</div>

Yeah!

@Sridhar update API is very expansive for ES. If you can, use PUT and overwritte a doc.

---

<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:** [February 9, 2018, 12:24pm UTC](https://discuss.elastic.co/t/adding-new-field-to-existing-index-in-es-5-6/114854/9 "2018-02-09T12:24:37Z")

</div>

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