# Store output of script\_fields in another field

**URL:** https://discuss.elastic.co/t/store-output-of-script-fields-in-another-field/88487
**Category:** Elasticsearch
**Created:** [June 6, 2017, 11:01pm UTC](https://discuss.elastic.co/t/store-output-of-script-fields-in-another-field/88487 "2017-06-06T23:01:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![elastic\_boston](https://avatars.discourse-cdn.com/v4/letter/e/a183cd/32.png) [@elastic\_boston](https://discuss.elastic.co/u/elastic_boston)
#### Post date: [June 6, 2017, 11:01pm UTC](https://discuss.elastic.co/t/store-output-of-script-fields-in-another-field/88487/1 "2017-06-06T23:01:03Z")

</div>

I need to update an index which was created in ES 1.x. The index has a timestamp field which is enabled, but not stored.

I am using the ES Java Update API. For regular fields, the index can be updated with a script as  
ctx.\_source.t1 = ctx.user

I can retrieve the timestamp field as  
GET twitter/\_search  
{  
"script\_fields": {  
"Timestamp": {  
"script": "\_fields['\_timestamp']"  
}  
}  
}

However, I want to update a field in the index with this script\_fields output. Is that possible?

---

<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: [July 4, 2017, 11:01pm UTC](https://discuss.elastic.co/t/store-output-of-script-fields-in-another-field/88487/2 "2017-07-04T23:01:50Z")

</div>

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