# Cannot implement native script following the 2 popular instructions

**URL:** https://discuss.elastic.co/t/cannot-implement-native-script-following-the-2-popular-instructions/38133
**Category:** Elasticsearch
**Created:** [December 30, 2015, 1:35am UTC](https://discuss.elastic.co/t/cannot-implement-native-script-following-the-2-popular-instructions/38133 "2015-12-30T01:35:59Z")
**Posts on this page:** 3
**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: [December 30, 2015, 1:35am UTC](https://discuss.elastic.co/t/cannot-implement-native-script-following-the-2-popular-instructions/38133/1 "2015-12-30T01:35:59Z")

</div>

I'm trying to use native script for custom scoring. There are two instructions I found:

- The first one:  
[http://www.spacevatican.org/2012/5/12/elasticsearch-native-scripts-for-dummies/](http://www.spacevatican.org/2012/5/12/elasticsearch-native-scripts-for-dummies/)  
When I run rake build, there's an error:

org/spacevatican/elasticsearchexample/CustomScript.java:22: error: cannot find symbol  
double a = doc().numeric("a").getDoubleValue();  
^ _(this one actually points at the "." after doc() )_  
symbol: method numeric(String)  
location: class DocLookup  
1 error

- The 2nd link: [https://github.com/imotov/elasticsearch-native-script-example](https://github.com/imotov/elasticsearch-native-script-example)  
I don't understand the instruction much, from the part "The parent project org.elasticsearch.plugin:plugins". Don't know where to find this parent project! May be because I'm very new to Java so I don't understand the structure here.

Can anyone jump in for some help? Thanks a lot!

---

<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: [December 30, 2015, 7:00pm UTC](https://discuss.elastic.co/t/cannot-implement-native-script-following-the-2-popular-instructions/38133/2 "2015-12-30T19:00:53Z")

</div>

So I seem to get the 1st instruction work, via changing  
`double a = doc().numeric("a").getDoubleValue();` to  
`double a = (double) doc().get("a");`  
Edit: I actually could compile, but query show error. Still trying to figure out!

The 2nd instruction, which has larger extend of examples and would better serve my need. But I don't get it either. Again, any help is highly appreciated. TIA.

---

<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:27pm UTC](https://discuss.elastic.co/t/cannot-implement-native-script-following-the-2-popular-instructions/38133/3 "2017-07-05T23:27:41Z")

</div>


