[SOLVED] Painless IDE plugin


(Christophe Bismuth) #1

Hi,

Painless language looks like Java, but it's not Java. Therefore IDE generate warnings and errors when editing Painless scripts with Java (or Groovy) editors.

As an ANTLR4 grammar is available, is there any plan to ship IDE plugins for first-class Painless scripting?

Thank you,
Chris


(Ryan Ernst) #2

There is not at this time The largest reason is that scripts in general have different variables available based on which part of the system they are used in, which script contexts are available (and which classes they have available to use within the scripts) are something we don't know until runtime (plugins can extend the whitelist painless uses). We do hope, however, to eventually have a UI within kibana that could be a limited IDE for painless, but it would do so by talking with a running elasticsearch instance.


(Christophe Bismuth) #3

That makes sense, thank you Ryan for this insight.

We've made an intense use of Painless in our business aggregation layer. The biggest script was approx 80 lines of code.

Our Painless scripts were developed in plain Java 8 within IntelliJ IDEA and were shipped with our application as Java source files. We've used Maven build helper and resource plugins to do so.

At runtime, these Java 8 resource files were loaded as strings and parsed with regex to be converted to valid Painless syntax: remove variable declarations, convert for loops, remove final modifiers, remove generics ...
Mean conversion time was approx 1ms.

Then the resulting Painless code was sent to Elasticsearch for compilation and execution.

At first sight it can seems overwhelming, I agree. It took us three days to setup this configuration. But we couldn't have developed these scripts with loops, conditions, bunch of lambdas and streams without a full-featured IDE.
We first tried with Sublime Text, but it was a nightmare: typos, missing syntax highlighting, missing code completion, missing code formatter ...

Painless performances were good: 300k docs aggregated in 800ms on a small cluster made of 3 nodes, against 10 gb daily indices (5 shards, 1 replica) containing 10 millions of docs per day.

I hope it can give a relevant customer use case.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.