# Create a Scripted field

**URL:** https://discuss.elastic.co/t/create-a-scripted-field/169763
**Category:** Elasticsearch
**Created:** [February 25, 2019, 7:44am UTC](https://discuss.elastic.co/t/create-a-scripted-field/169763 "2019-02-25T07:44:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![examin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/examin/32/70688_2.png) [@examin](https://discuss.elastic.co/u/examin)
#### Post date: [February 25, 2019, 7:44am UTC](https://discuss.elastic.co/t/create-a-scripted-field/169763/1 "2019-02-25T07:44:36Z")

</div>

I have a field Recieved\_Date , I need two more field month and day from Recieved\_Date to query easily. What i sbest way to do so, i think my options are to re-index whole data with a new mapping or create a scripted field. I don't use kibana so, how can i use scripted field?

---

<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: [February 25, 2019, 8:18am UTC](https://discuss.elastic.co/t/create-a-scripted-field/169763/2 "2019-02-25T08:18:19Z")

</div>

I'd probably use ingest pipeline feature with a Script processor to make that fields part of the `_source` document when reindexing the whole dataset.

That will avoid having to compute all the values at search time, which a script field does.

---

<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: [March 25, 2019, 8:18am UTC](https://discuss.elastic.co/t/create-a-scripted-field/169763/3 "2019-03-25T08:18:21Z")

</div>

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