Cannot implement native script following the 2 popular instructions

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

org/spacevatican/elasticsearchexample/ 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:
    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!

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.