elasticsearch/docs/reference/scripting-languages/painless/painless-lambdas.md
Colleen McGinnis ab5ff67bce
[docs] Add products to docset.yml (#128274)
* add products to docset.yml

* add page-level painless tags
2025-05-21 13:55:32 -05:00

623 B

mapped_pages products
https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-lambdas.html
id
painless

Lambdas [painless-lambdas]

Lambda expressions and method references work the same as in Java.

list.removeIf(item -> item == 2);
list.removeIf((int item) -> item == 2);
list.removeIf((int item) -> { item == 2 });
list.sort((x, y) -> x - y);
list.sort(Integer::compare);

You can make method references to functions within the script with this, for example list.sort(this::mycompare).