이 페이지의 콘텐츠는 선택하신 언어로 제공되지 않습니다. Elastic은 다양한 언어로 콘텐츠를 제공하기 위해 최선을 다하고 있습니다.조금만 더 기다려주세요!
How to

Painless: A New Scripting Language

A little over a year ago, I received a phone call one evening about an opportunity to come build an embedded programming language into Elasticsearch.  Initially, I thought the idea was a crazy one.  Why build a brand new language when there are already so many to choose from?  But, as it turns out, it is very difficult to properly secure a language that can be executed remotely without that feature being thought of during the initial design phase.   So, with that in mind, I’m pleased to introduce Painless, a new scripting language in Elasticsearch 5.0, designed from the ground up to be both secure and performant.

Painless is a dynamic scripting language with syntax similar to Groovy.  Painless scripts are composed of optionally some number of static methods and a required single main section of code.  Some highlights of Painless include the following:

Painless can be used anywhere in Elasticsearch where scripts can normally be run by specifying the 'lang' parameter as 'painless'.  Painless will also become the default language in Elasticsearch 5.0.  Full documentation can be found here.

On a final note, I would like to thank both Robert Muir and Uwe Schindler for their significant contributions related the dynamic side of Painless, and also to Nik Everett for his significant contribution of regular expressions.  Uwe even had several methods related to array length added directly to Java to eek out the best dynamic performance possible.

Jack Conradson is currently a developer at Elasticsearch where he continues to work on improvements to scripting.  Prior to Elasticsearch, Jack worked at A9.com, where he developed the Expressions language and simple query parser for Apache Lucene.