Scripting Enhancements: more langs, better performance


(Shay Banon) #1

Hi,

Over the past couple of weeks I have improved the scripting support in
elasticsearch, with the main feature of supporting more languages then the
default mvel. The current list of supported langs are: JavaScript, Python,
and Groovy.

Now, any component in elasticsearch (custom_score query, facets, and so
on) also accepts a lang (on the same level as the script) where the language
can be chosen. The default lang to use when non is configured can be defined
by setting script.default_lang. The default is mvel.

In addition, there is now an option to define scripts within the node
config folder, so they will be precompiled and registered under a short
name, which can then be used to define the script (no lang required when
using it). This means there is no need to pass the full script around. It is
explained here:
http://github.com/elasticsearch/elasticsearch/issues/closed#issue/429.

Out of the languages I wanted to support was also ruby using jruby, but
it proved to be more difficult than expected, we'll see if it gets in once
the jruby community answers anything on the mailing list...., it it works
the way I think it does, than its problematic.

There has been a lot of work going into executing scripts as fast as
possible, optimized to the nature of how they are executed within
elasticsearch. Also, once this building block is in, I hope to sprinkle
scripts in more places across the codebase.

-shay.banon


(James Cook) #2

We use Javascript end-to-end, so it would be great to see this added. This
is especially useful given the internal JSON format.

-- jim

On Thu, Oct 14, 2010 at 10:26 AM, Shay Banon
shay.banon@elasticsearch.comwrote:

Hi,

Over the past couple of weeks I have improved the scripting support in
elasticsearch, with the main feature of supporting more languages then the
default mvel. The current list of supported langs are: JavaScript, Python,
and Groovy.

Now, any component in elasticsearch (custom_score query, facets, and so
on) also accepts a lang (on the same level as the script) where the language
can be chosen. The default lang to use when non is configured can be defined
by setting script.default_lang. The default is mvel.

In addition, there is now an option to define scripts within the node
config folder, so they will be precompiled and registered under a short
name, which can then be used to define the script (no lang required when
using it). This means there is no need to pass the full script around. It is
explained here:
http://github.com/elasticsearch/elasticsearch/issues/closed#issue/429.

Out of the languages I wanted to support was also ruby using jruby, but
it proved to be more difficult than expected, we'll see if it gets in once
the jruby community answers anything on the mailing list...., it it works
the way I think it does, than its problematic.

There has been a lot of work going into executing scripts as fast as
possible, optimized to the nature of how they are executed within
elasticsearch. Also, once this building block is in, I hope to sprinkle
scripts in more places across the codebase.

-shay.banon


(system) #3