# How update/over ride the existing ES document through Groovey

**URL:** <https://discuss.elastic.co/t/how-update-over-ride-the-existing-es-document-through-groovey/99190>\
**Category:** Elasticsearch\
**Created:** [September 2, 2017, 12:20pm UTC](https://discuss.elastic.co/t/how-update-over-ride-the-existing-es-document-through-groovey/99190 "2017-09-02T12:20:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogeswararao](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@yogeswararao](https://discuss.elastic.co/u/yogeswararao)\
**Post date:** [September 2, 2017, 12:20pm UTC](https://discuss.elastic.co/t/how-update-over-ride-the-existing-es-document-through-groovey/99190/1 "2017-09-02T12:20:26Z")

</div>

How to add update/override the ES document in Groovey.

This is the document injected into the ES:

'[http://localhost:9200/Test/log/Sample.Test](http://localhost:9200/Test/log/Sample.Test)' -d '  
{  
"@type": "iapi.log",  
"@timestamp": "2017-09-02T03:34:45.399Z",  
"@source\_host": "esu1l231.federated.fds",  
"@message": "TEST",  
"@environment": "DEV",  
"@fields": {  
"AppID": "DCR",  
"TransactionID": "12-203-809-49181-42-131-822980900282-5242-146873621",  
"CorrelationID": "6f39b6d3-85fd-44e1-b30a-bb1dced34f25",  
"TransactionDomain": "Inventory",  
"ElapsedTime": "0",  
"AppDomain": "D2CSPF\_PRD09",  
"Metrics": {  
"Sample.Test": "DCR\_EMS\_STATS\_RcvToCollSales",  
"TOTAL\_MSGS": 2000,  
"MSGS\_PENDING": 12,  
"MSGS\_FAILED": 1100  
}  
}  
}'

I want updated to

{  
"@type": "iapi.log",  
"@timestamp": "2017-09-02T03:34:45.399Z",  
"@source\_host": "esu1l231.federated.fds",  
"@message": "TEST",  
"@environment": "DEV",  
"@fields": {  
"AppID": "DCR1",  
"TransactionID": "12",  
"CorrelationID": "664546",  
"TransactionDomain": "Sample",  
"ElapsedTime": "0",  
"AppDomain": "Test",  
"Metrics": {  
"Sample.Test": "DCR\_EMS\_STATS\_RcvToCollSales",  
"TOTAL\_MSGS": 200,  
"MSGS\_PENDING": 20,  
"MSGS\_FAILED": 110  
}  
}  
}'

---

<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:** [September 30, 2017, 12:20pm UTC](https://discuss.elastic.co/t/how-update-over-ride-the-existing-es-document-through-groovey/99190/2 "2017-09-30T12:20:40Z")

</div>

Closed on September 30, 2017, 12:20pm UTC

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