# Advanced JSON Input Script doesnt work

**URL:** https://discuss.elastic.co/t/advanced-json-input-script-doesnt-work/179534
**Category:** Elasticsearch
**Tags:** painless
**Created:** [May 3, 2019, 12:29pm UTC](https://discuss.elastic.co/t/advanced-json-input-script-doesnt-work/179534 "2019-05-03T12:29:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![6tUBp3gwd9Zp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6tubp3gwd9zp/32/45240_2.png) [@6tUBp3gwd9Zp](https://discuss.elastic.co/u/6tUBp3gwd9Zp)
#### Post date: [May 3, 2019, 12:29pm UTC](https://discuss.elastic.co/t/advanced-json-input-script-doesnt-work/179534/1 "2019-05-03T12:29:18Z")

</div>

When I try to run this script it tells me 5 shards of 240 failed.

```
{
  "script": {
"inline": "float u_x = Math.abs(doc['x'].value-doc['x'].value)-doc['x'].value;float u_y = Math.abs(doc['y'].value-doc['y'].value)-doc['y'].value;float v_x = Math.abs(doc['x'].value-doc['x'].value)-doc['x'].value;float v_y = Math.abs(doc['y'].value-doc['y'].value)-doc['y'].value;return (180/3.14159265359)*Math.acos((u_x*v_x+u_y*v_y)/(Math.sqrt(u_x*u_x+u_y*u_y)*Math.sqrt(v_x*v_x+v_y*v_y)));",
"lang": "painless"
  }
}
```

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [May 6, 2019, 8:14am UTC](https://discuss.elastic.co/t/advanced-json-input-script-doesnt-work/179534/2 "2019-05-06T08:14:07Z")

</div>

This is just a wild guess, as you haven't provided any further exception message, but I suppose that 5 shards have a different (or no) mapping for one of the fields used in that script, i.e. a string instead of a number.

--Alex

---

<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: [June 3, 2019, 8:14am UTC](https://discuss.elastic.co/t/advanced-json-input-script-doesnt-work/179534/3 "2019-06-03T08:14:07Z")

</div>

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