# Native script inconsistent (not found)

**URL:** <https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839>\
**Category:** Elasticsearch\
**Created:** [January 22, 2016, 2:14am UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839 "2016-01-22T02:14:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cuongvt101](https://avatars.discourse-cdn.com/v4/letter/c/dc4da7/32.png) [@cuongvt101](https://discuss.elastic.co/u/cuongvt101)\
**Post date:** [January 22, 2016, 2:14am UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839/1 "2016-01-22T02:14:24Z")

</div>

I was given a development cluster with 2 nodes, there're about 700 indexes there. I installed a plugin and it works very inconsistently. Sometimes it works normally, sometimes when I modify the code a bit, I can build and install the new code successfully but when I run query, it throws an error that "Native script [abc] not found". Then I modify the code and install again, it works again. Note again that there was no error every time I install the plugin. And of course I did restart elastic every time I install the plugin. Can anyone help pinpoint the possible reason for that behavior? Thanks a lot.

Btw I'm using Elasticsearch 1.7 and the cluster's health status is always yellow!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 22, 2016, 3:30am UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839/2 "2016-01-22T03:30:49Z")

</div>

You haven't given us much to really go on.

What errors did you get, the exact error?  
What does the script look like?  
What does your ES config look like?

---

<div class="post-metadata">

**Author:** ![cuongvt101](https://avatars.discourse-cdn.com/v4/letter/c/dc4da7/32.png) [@cuongvt101](https://discuss.elastic.co/u/cuongvt101)\
**Post date:** [January 22, 2016, 6:33am UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839/3 "2016-01-22T06:33:07Z")

</div>

Hi Mark, here's the cluster's health:  
{  
"cluster\_name" : "searchme",  
"status" : "yellow",  
"timed\_out" : false,  
"number\_of\_nodes" : 2,  
"number\_of\_data\_nodes" : 2,  
"active\_primary\_shards" : 3711,  
"active\_shards" : 3711,  
"relocating\_shards" : 0,  
"initializing\_shards" : 0,  
"unassigned\_shards" : 3711,  
"number\_of\_pending\_tasks" : 0  
}

Currently I am testing the Cosine Similarity Script by Imotov on github:

> <https://github.com/imotov/elasticsearch-native-script-example/blob/1.x/src/main/java/org/elasticsearch/examples/nativescript/script/CosineSimilarityScoreScript.java>

And here's the error I got:

`nested: QueryParsingException[[example_index] script_score the script could not be loaded]; nested: ElasticsearchIllegalArgumentException[Native script [cosine_sim_script_score] not found]`

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 22, 2016, 6:40am UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839/4 "2016-01-22T06:40:30Z")

</div>

That's a pretty crazy number of shards you have, why so many? And why are so many unassigned?

Anyway, ES says it cannot find the script, so where did you place it?

---

<div class="post-metadata">

**Author:** ![cuongvt101](https://avatars.discourse-cdn.com/v4/letter/c/dc4da7/32.png) [@cuongvt101](https://discuss.elastic.co/u/cuongvt101)\
**Post date:** [January 22, 2016, 2:38pm UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839/5 "2016-01-22T14:38:45Z")

</div>

It's a development cluster so quite a few people used/are using it to test and might forget to delete their data in the end.

The plugin is put in elastic/plugins along with other plugins. Like I said, sometimes it was able to find the script, but sometimes just wasn't.

Btw, if I already have the plugin installed, then I modify the code a little bit, rebuild, then reinstall, the plugin name still stays the same, do I have to restart Elasticsearch? Currently I restart elastic every time I install even though some time the change is very minor.

---

<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:** [July 5, 2017, 11:22pm UTC](https://discuss.elastic.co/t/native-script-inconsistent-not-found/39839/6 "2017-07-05T23:22:15Z")

</div>


