# 0.19.10 - Can not get the lang-javascript working

**URL:** https://discuss.elastic.co/t/0-19-10-can-not-get-the-lang-javascript-working/9644
**Category:** Elasticsearch
**Created:** [November 9, 2012, 10:25am UTC](https://discuss.elastic.co/t/0-19-10-can-not-get-the-lang-javascript-working/9644 "2012-11-09T10:25:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nicolas\_Lagoutte](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Nicolas\_Lagoutte](https://discuss.elastic.co/u/Nicolas_Lagoutte)
#### Post date: [November 9, 2012, 10:25am UTC](https://discuss.elastic.co/t/0-19-10-can-not-get-the-lang-javascript-working/9644/1 "2012-11-09T10:25:02Z")

</div>

Hi board !

I'v been trying to use an custom sort script using mvel, all went well  
until I started working with arrays.  
I did some research and found that issue[https://github.com/elasticsearch/elasticsearch/pull/2291](https://github.com/elasticsearch/elasticsearch/pull/2291)on the tracker, it doesn't looks like a fix will be available soon.

Apparently one of the workaround is to use another lang for the script, so  
I tried the javascript one: can't get it working.  
I suppose (hope) I've missed a step or did something wrong - I'm on Ubuntu  
12.04:

- sudo elasticsearch/bin/plugin -install  
elasticsearch/elasticsearch-lang-javascript
- put "plugin.mandatory: lang-javascript" in  
/etc/elasticsearch/elasticsearch.yaml to make sure the plugin is here and  
correctly installed
- sudo service elasticsearch stop (then start)

The logs mention the plugin:  
[2012-11-09 10:20:16,784][INFO][plugins] [Sekhmet]loaded  
[], sites [lang-javascript]

But whenever I try a script query, I receive that answer:  
script\_lang not supported [js]

Here is a query sample:  
{  
"query": {  
"term":{  
"user":"nico"  
}  
},  
"sort": {  
"\_script":{  
"script":"doc['user'].value ? 1 : 0",  
"type" : "number",  
"lang" : "js"  
}  
}  
}

Any ideas ?

Thank a lot.

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [November 9, 2012, 10:34pm UTC](https://discuss.elastic.co/t/0-19-10-can-not-get-the-lang-javascript-working/9644/2 "2012-11-09T22:34:14Z")

</div>

You didn't specify the plugin version, as a result the plugin was installed  
as a site plugin. But it's easy to fix. Shut down the server, and run the  
following command to remove site plugin installation first

```
sudo elasticsearch/bin/plugin -remove lang-javascript

```

and then install the plugin with correct version (currenlty 1.2.0)

```
sudo elasticsearch/bin/plugin -install 

```

elasticsearch/elasticsearch-lang-javascript/1.2.0

Start server and check the log, it should look like this:

[2012-11-09 17:32:16,458][INFO][plugins] [Wagner, Kurt]  
loaded [lang-javascript], sites

On Friday, November 9, 2012 5:25:03 AM UTC-5, Nicolas Lagoutte wrote:

> Hi board !
> 
> I'v been trying to use an custom sort script using mvel, all went well  
> until I started working with arrays.  
> I did some research and found that issue[https://github.com/elasticsearch/elasticsearch/pull/2291](https://github.com/elasticsearch/elasticsearch/pull/2291)on the tracker, it doesn't looks like a fix will be available soon.
> 
> Apparently one of the workaround is to use another lang for the script, so  
> I tried the javascript one: can't get it working.  
> I suppose (hope) I've missed a step or did something wrong - I'm on Ubuntu  
> 12.04:
> 
> - sudo elasticsearch/bin/plugin -install  
> elasticsearch/elasticsearch-lang-javascript
> - put "plugin.mandatory: lang-javascript" in  
> /etc/elasticsearch/elasticsearch.yaml to make sure the plugin is here and  
> correctly installed
> - sudo service elasticsearch stop (then start)
> 
> The logs mention the plugin:  
> [2012-11-09 10:20:16,784][INFO][plugins] [Sekhmet]loaded  
> , sites [lang-javascript]
> 
> But whenever I try a script query, I receive that answer:  
> script\_lang not supported [js]
> 
> Here is a query sample:  
> {  
> "query": {  
> "term":{  
> "user":"nico"  
> }  
> },  
> "sort": {  
> "\_script":{  
> "script":"doc['user'].value ? 1 : 0",  
> "type" : "number",  
> "lang" : "js"  
> }  
> }  
> }
> 
> Any ideas ?
> 
> Thank a lot.

--

---

<div class="post-metadata">

### Author: ![Nicolas\_Lagoutte](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Nicolas\_Lagoutte](https://discuss.elastic.co/u/Nicolas_Lagoutte)
#### Post date: [November 12, 2012, 9:04am UTC](https://discuss.elastic.co/t/0-19-10-can-not-get-the-lang-javascript-working/9644/3 "2012-11-12T09:04:01Z")

</div>

Ah ! Thank You Igor ! It works fine with the version.  
I'm a bit confused though, the documentation about plugins here[http://www.elasticsearch.org/guide/reference/modules/plugins.html](http://www.elasticsearch.org/guide/reference/modules/plugins.html)states that without a version the master branch would be used. Is there a  
bug with that behaviour ?

Le vendredi 9 novembre 2012 22:34:14 UTC, Igor Motov a écrit :

> You didn't specify the plugin version, as a result the plugin was  
> installed as a site plugin. But it's easy to fix. Shut down the server, and  
> run the following command to remove site plugin installation first
> 
> ```
> sudo elasticsearch/bin/plugin -remove lang-javascript
> 
> ```
> 
> and then install the plugin with correct version (currenlty 1.2.0)
> 
> ```
> sudo elasticsearch/bin/plugin -install 
> 
> ```
> 
> elasticsearch/elasticsearch-lang-javascript/1.2.0
> 
> Start server and check the log, it should look like this:
> 
> [2012-11-09 17:32:16,458][INFO][plugins] [Wagner, Kurt]  
> loaded [lang-javascript], sites
> 
> On Friday, November 9, 2012 5:25:03 AM UTC-5, Nicolas Lagoutte wrote:
> 
> > Hi board !
> > 
> > I'v been trying to use an custom sort script using mvel, all went well  
> > until I started working with arrays.  
> > I did some research and found that issue[https://github.com/elasticsearch/elasticsearch/pull/2291](https://github.com/elasticsearch/elasticsearch/pull/2291)on the tracker, it doesn't looks like a fix will be available soon.
> > 
> > Apparently one of the workaround is to use another lang for the script,  
> > so I tried the javascript one: can't get it working.  
> > I suppose (hope) I've missed a step or did something wrong - I'm on  
> > Ubuntu 12.04:
> > 
> > - sudo elasticsearch/bin/plugin -install  
> > elasticsearch/elasticsearch-lang-javascript
> > - put "plugin.mandatory: lang-javascript" in  
> > /etc/elasticsearch/elasticsearch.yaml to make sure the plugin is here and  
> > correctly installed
> > - sudo service elasticsearch stop (then start)
> > 
> > The logs mention the plugin:  
> > [2012-11-09 10:20:16,784][INFO][plugins] [Sekhmet]loaded  
> > , sites [lang-javascript]
> > 
> > But whenever I try a script query, I receive that answer:  
> > script\_lang not supported [js]
> > 
> > Here is a query sample:  
> > {  
> > "query": {  
> > "term":{  
> > "user":"nico"  
> > }  
> > },  
> > "sort": {  
> > "\_script":{  
> > "script":"doc['user'].value ? 1 : 0",  
> > "type" : "number",  
> > "lang" : "js"  
> > }  
> > }  
> > }
> > 
> > Any ideas ?
> > 
> > Thank a lot.

--

---

<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 6, 2017, 3:04am UTC](https://discuss.elastic.co/t/0-19-10-can-not-get-the-lang-javascript-working/9644/4 "2017-07-06T03:04:50Z")

</div>


