# How to modify the content of the field in source?

**URL:** <https://discuss.elastic.co/t/how-to-modify-the-content-of-the-field-in-source/372097>\
**Category:** Elasticsearch\
**Created:** [December 18, 2024, 2:08am UTC](https://discuss.elastic.co/t/how-to-modify-the-content-of-the-field-in-source/372097 "2024-12-18T02:08:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoopaan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoopaan/32/140088_2.png) [@yoopaan](https://discuss.elastic.co/u/yoopaan)\
**Post date:** [December 18, 2024, 2:08am UTC](https://discuss.elastic.co/t/how-to-modify-the-content-of-the-field-in-source/372097/1 "2024-12-18T02:08:18Z")

</div>

I want to process the query return value of the document in the source code and implement the following operations:

index:

```auto
{ "id": 1001,
"title":"abcd"
}

```

return:

```auto
{
"id": 1001,
"title": "bcde"
}

```

That is, replace the field, and the length of the string before and after the replacement is the same.

How to achieve this goal？

---

<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:** [December 18, 2024, 3:18am UTC](https://discuss.elastic.co/t/how-to-modify-the-content-of-the-field-in-source/372097/2 "2024-12-18T03:18:04Z")

</div>

Welcome!

May be [runtime fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime.html) could help. From the doc (emphasis is mine):

> A _runtime field_ is a field that is evaluated at query time. Runtime fields enable you to:
> 
> - Add fields to existing documents without reindexing your data
> - Start working with your data without understanding how it’s structured
> - **Override the value returned from an indexed field at query time**
> - Define fields for a specific use without modifying the underlying schema
