# How to use original \`text\` filed in script field

**URL:** <https://discuss.elastic.co/t/how-to-use-original-text-filed-in-script-field/357501>\
**Category:** Elastic Search\
**Created:** [April 16, 2024, 9:56am UTC](https://discuss.elastic.co/t/how-to-use-original-text-filed-in-script-field/357501 "2024-04-16T09:56:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Southpika](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/southpika/32/133557_2.png) [@Southpika](https://discuss.elastic.co/u/Southpika)\
**Post date:** [April 16, 2024, 9:56am UTC](https://discuss.elastic.co/t/how-to-use-original-text-filed-in-script-field/357501/1 "2024-04-16T09:56:46Z")

</div>

I want to create a new script field by extracting some content(like use regex to parse time) from a text filed named "@raw",.  
However, When I use doc["@raw"], it raise error"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [@raw] in order to load field data by uninverting the inverted index. Note that this can use significant memory."  
If I use doc["@raw.keyword"], I get empty, but it is not empty in {"\_source": "@raw"]}  
How I can solve this problem, many thanks!!

---

<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:** [May 14, 2024, 9:57am UTC](https://discuss.elastic.co/t/how-to-use-original-text-filed-in-script-field/357501/2 "2024-05-14T09:57:06Z")

</div>

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