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.