# Repair index after a wrong scripted field

**URL:** <https://discuss.elastic.co/t/repair-index-after-a-wrong-scripted-field/127491>\
**Category:** Elasticsearch\
**Created:** [April 10, 2018, 1:42pm UTC](https://discuss.elastic.co/t/repair-index-after-a-wrong-scripted-field/127491 "2018-04-10T13:42:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![florentmair](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@florentmair](https://discuss.elastic.co/u/florentmair)\
**Post date:** [April 10, 2018, 1:42pm UTC](https://discuss.elastic.co/t/repair-index-after-a-wrong-scripted-field/127491/1 "2018-04-10T13:42:42Z")

</div>

hello

i have created a scripted field on metricbeat index to know the lifetime of some process.  
Well now i am not able to see anymore ont he Kibana discover page.

I have the warning "Courier Fetch: 2 of 8 shards failed." and nothing appear

ans the elasticsearch log i have this error  
Caused by: java.lang.ClassCastException: Cannot apply [-] operation to types [org.joda.time.MutableDateTime] and [org.joda.time.DateTime].  
at org.elasticsearch.painless.DefMath.sub(DefMath.java:488) ~[?:?]  
at org.elasticsearch.painless.PainlessScript$Script.execute(doc['@timestamp'].value-doc['system.process.cpu.start\_time'].value:61) ~[?:?]  
at org.elasticsearch.painless.ScriptImpl.run(ScriptImpl.java:105) ~[?:?]  
at org.elasticsearch.search.fetch.subphase.ScriptFieldsFetchSubPhase.hitsExecute(ScriptFieldsFetchSubPhase.java:67) ~[elasticsearch-6.2.3.jar:6.2.3]

So my question is how i can fix that ?

---

<div class="post-metadata">

**Author:** ![florentmair](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@florentmair](https://discuss.elastic.co/u/florentmair)\
**Post date:** [April 10, 2018, 1:54pm UTC](https://discuss.elastic.co/t/repair-index-after-a-wrong-scripted-field/127491/2 "2018-04-10T13:54:37Z")

</div>

Okay, i hadn't delete the scripted field....

---

<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 8, 2018, 1:54pm UTC](https://discuss.elastic.co/t/repair-index-after-a-wrong-scripted-field/127491/3 "2018-05-08T13:54:43Z")

</div>

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