scripting.asciidoc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [[modules-scripting]]
  2. == Scripting
  3. The scripting module enables you to use scripts to evaluate custom
  4. expressions. For example, you could use a script to return "script fields"
  5. as part of a search request or evaluate a custom score for a query.
  6. The default scripting language is <<modules-scripting-painless, `Painless`>>.
  7. Additional `lang` plugins enable you to run scripts written in other languages.
  8. Everywhere a script can be used, you can include a `lang` parameter
  9. to specify the language of the script.
  10. [float]
  11. === General-purpose languages:
  12. These languages can be used for any purpose in the scripting APIs,
  13. and give the most flexibility.
  14. [cols="<,<,<",options="header",]
  15. |=======================================================================
  16. |Language
  17. |Sandboxed
  18. |Required plugin
  19. |<<modules-scripting-painless, `painless`>>
  20. |yes
  21. |built-in
  22. |=======================================================================
  23. [float]
  24. === Special-purpose languages:
  25. These languages are less flexible, but typically have higher performance for
  26. certain tasks.
  27. [cols="<,<,<,<",options="header",]
  28. |=======================================================================
  29. |Language
  30. |Sandboxed
  31. |Required plugin
  32. |Purpose
  33. |<<modules-scripting-expression, `expression`>>
  34. |yes
  35. |built-in
  36. |fast custom ranking and sorting
  37. |<<search-template, `mustache`>>
  38. |yes
  39. |built-in
  40. |templates
  41. |<<modules-scripting-engine, `java`>>
  42. |n/a
  43. |you write it!
  44. |expert API
  45. |=======================================================================
  46. [WARNING]
  47. .Scripts and security
  48. =================================================
  49. Languages that are sandboxed are designed with security in mind. However, non-
  50. sandboxed languages can be a security issue, please read
  51. <<modules-scripting-security, Scripting and security>> for more details.
  52. =================================================
  53. include::scripting/using.asciidoc[]
  54. include::scripting/fields.asciidoc[]
  55. include::scripting/security.asciidoc[]
  56. include::scripting/painless.asciidoc[]
  57. include::scripting/expression.asciidoc[]
  58. include::scripting/engine.asciidoc[]