scripting.asciidoc 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. [[modules-scripting]]
  2. == Scripting
  3. The scripting module allows to use scripts in order to evaluate custom
  4. expressions. For example, scripts can be used to return "script fields"
  5. as part of a search request, or can be used to evaluate a custom score
  6. for a query and so on.
  7. The scripting module uses by default http://groovy-lang.org/[groovy]
  8. (previously http://mvel.codehaus.org/[mvel] in 1.3.x and earlier) as the
  9. scripting language with some extensions. Groovy is used since it is extremely
  10. fast and very simple to use.
  11. .Groovy dynamic scripting off by default from v1.4.3
  12. [IMPORTANT]
  13. ===================================================
  14. Groovy dynamic scripting is off by default, preventing dynamic Groovy scripts
  15. from being accepted as part of a request or retrieved from the special
  16. `.scripts` index. You will still be able to use Groovy scripts stored in files
  17. in the `config/scripts/` directory on every node.
  18. To convert an inline script to a file, take this simple script
  19. as an example:
  20. [source,js]
  21. -----------------------------------
  22. GET /_search
  23. {
  24. "script_fields": {
  25. "my_field": {
  26. "inline": "1 + my_var",
  27. "params": {
  28. "my_var": 2
  29. }
  30. }
  31. }
  32. }
  33. -----------------------------------
  34. Save the contents of the `inline` field as a file called `config/scripts/my_script.groovy`
  35. on every data node in the cluster:
  36. [source,js]
  37. -----------------------------------
  38. 1 + my_var
  39. -----------------------------------
  40. Now you can access the script by file name (without the extension):
  41. [source,js]
  42. -----------------------------------
  43. GET /_search
  44. {
  45. "script_fields": {
  46. "my_field": {
  47. "file": "my_script",
  48. "params": {
  49. "my_var": 2
  50. }
  51. }
  52. }
  53. }
  54. -----------------------------------
  55. ===================================================
  56. Additional `lang` plugins are provided to allow to execute scripts in
  57. different languages. All places where a script can be used, a `lang` parameter
  58. can be provided to define the language of the script. The following are the
  59. supported scripting languages:
  60. [cols="<,<,<",options="header",]
  61. |=======================================================================
  62. |Language |Sandboxed |Required plugin
  63. |groovy |no |built-in
  64. |expression |yes |built-in
  65. |mustache |yes |built-in
  66. |mvel |no |https://github.com/elastic/elasticsearch-lang-mvel[elasticsearch-lang-mvel]
  67. |javascript |no |https://github.com/elastic/elasticsearch-lang-javascript[elasticsearch-lang-javascript]
  68. |python |no |https://github.com/elastic/elasticsearch-lang-python[elasticsearch-lang-python]
  69. |=======================================================================
  70. To increase security, Elasticsearch does not allow you to specify scripts for
  71. non-sandboxed languages with a request. Instead, scripts must be placed in the
  72. `scripts` directory inside the configuration directory (the directory where
  73. elasticsearch.yml is). The default location of this `scripts` directory can be
  74. changed by setting `path.scripts` in elasticsearch.yml. Scripts placed into
  75. this directory will automatically be picked up and be available to be used.
  76. Once a script has been placed in this directory, it can be referenced by name.
  77. For example, a script called `calculate-score.groovy` can be referenced in a
  78. request like this:
  79. [source,sh]
  80. --------------------------------------------------
  81. $ tree config
  82. config
  83. ├── elasticsearch.yml
  84. ├── logging.yml
  85. └── scripts
  86. └── calculate-score.groovy
  87. --------------------------------------------------
  88. [source,sh]
  89. --------------------------------------------------
  90. $ cat config/scripts/calculate-score.groovy
  91. log(_score * 2) + my_modifier
  92. --------------------------------------------------
  93. [source,js]
  94. --------------------------------------------------
  95. curl -XPOST localhost:9200/_search -d '{
  96. "query": {
  97. "function_score": {
  98. "query": {
  99. "match": {
  100. "body": "foo"
  101. }
  102. },
  103. "functions": [
  104. {
  105. "script_score": {
  106. "script": {
  107. "lang": "groovy",
  108. "file": "calculate-score",
  109. "params": {
  110. "my_modifier": 8
  111. }
  112. }
  113. }
  114. }
  115. ]
  116. }
  117. }
  118. }'
  119. --------------------------------------------------
  120. The name of the script is derived from the hierarchy of directories it
  121. exists under, and the file name without the lang extension. For example,
  122. a script placed under `config/scripts/group1/group2/test.py` will be
  123. named `group1_group2_test`.
  124. [float]
  125. === Indexed Scripts
  126. Elasticsearch allows you to store scripts in an internal index known as
  127. `.scripts` and reference them by id. There are REST endpoints to manage
  128. indexed scripts as follows:
  129. Requests to the scripts endpoint look like :
  130. [source,js]
  131. -----------------------------------
  132. /_scripts/{lang}/{id}
  133. -----------------------------------
  134. Where the `lang` part is the language the script is in and the `id` part is the id
  135. of the script. In the `.scripts` index the type of the document will be set to the `lang`.
  136. [source,js]
  137. -----------------------------------
  138. curl -XPOST localhost:9200/_scripts/groovy/indexedCalculateScore -d '{
  139. "script": "log(_score * 2) + my_modifier"
  140. }'
  141. -----------------------------------
  142. This will create a document with id: `indexedCalculateScore` and type: `groovy` in the
  143. `.scripts` index. The type of the document is the language used by the script.
  144. This script can be accessed at query time by using the `id` script parameter and passing
  145. the script id:
  146. [source,js]
  147. --------------------------------------------------
  148. curl -XPOST localhost:9200/_search -d '{
  149. "query": {
  150. "function_score": {
  151. "query": {
  152. "match": {
  153. "body": "foo"
  154. }
  155. },
  156. "functions": [
  157. {
  158. "script_score": {
  159. "script": {
  160. "id": "indexedCalculateScore",
  161. "lang" : "groovy",
  162. "params": {
  163. "my_modifier": 8
  164. }
  165. }
  166. }
  167. }
  168. ]
  169. }
  170. }
  171. }'
  172. --------------------------------------------------
  173. The script can be viewed by:
  174. [source,js]
  175. -----------------------------------
  176. curl -XGET localhost:9200/_scripts/groovy/indexedCalculateScore
  177. -----------------------------------
  178. This is rendered as:
  179. [source,js]
  180. -----------------------------------
  181. '{
  182. "script": "log(_score * 2) + my_modifier"
  183. }'
  184. -----------------------------------
  185. Indexed scripts can be deleted by:
  186. [source,js]
  187. -----------------------------------
  188. curl -XDELETE localhost:9200/_scripts/groovy/indexedCalculateScore
  189. -----------------------------------
  190. [float]
  191. [[enable-dynamic-scripting]]
  192. === Enabling dynamic scripting
  193. We recommend running Elasticsearch behind an application or proxy, which
  194. protects Elasticsearch from the outside world. If users are allowed to run
  195. inline scripts (even in a search request) or indexed scripts, then they have
  196. the same access to your box as the user that Elasticsearch is running as. For
  197. this reason dynamic scripting is allowed only for sandboxed languages by default.
  198. First, you should not run Elasticsearch as the `root` user, as this would allow
  199. a script to access or do *anything* on your server, without limitations. Second,
  200. you should not expose Elasticsearch directly to users, but instead have a proxy
  201. application inbetween. If you *do* intend to expose Elasticsearch directly to
  202. your users, then you have to decide whether you trust them enough to run scripts
  203. on your box or not.
  204. It is possible to enable scripts based on their source, for
  205. every script engine, through the following settings that need to be added to the
  206. `config/elasticsearch.yml` file on every node.
  207. [source,yaml]
  208. -----------------------------------
  209. script.inline: on
  210. script.indexed: on
  211. -----------------------------------
  212. While this still allows execution of named scripts provided in the config, or
  213. _native_ Java scripts registered through plugins, it also allows users to run
  214. arbitrary scripts via the API. Instead of sending the name of the file as the
  215. script, the body of the script can be sent instead or retrieved from the
  216. `.scripts` indexed if previously stored.
  217. There are three possible configuration values for any of the fine-grained
  218. script settings:
  219. [cols="<,<",options="header",]
  220. |=======================================================================
  221. |Value |Description
  222. | `off` |scripting is turned off completely, in the context of the setting being set.
  223. | `on` |scripting is turned on, in the context of the setting being set.
  224. | `sandbox` |scripts may be executed only for languages that are sandboxed
  225. |=======================================================================
  226. The default values are the following:
  227. [source,yaml]
  228. -----------------------------------
  229. script.inline: sandbox
  230. script.indexed: sandbox
  231. script.file: on
  232. -----------------------------------
  233. NOTE: Global scripting settings affect the `mustache` scripting language.
  234. <<search-template,Search templates>> internally use the `mustache` language,
  235. and will still be enabled by default as the `mustache` engine is sandboxed,
  236. but they will be enabled/disabled according to fine-grained settings
  237. specified in `elasticsearch.yml`.
  238. It is also possible to control which operations can execute scripts. The
  239. supported operations are:
  240. [cols="<,<",options="header",]
  241. |=======================================================================
  242. |Value |Description
  243. | `aggs` |Aggregations (wherever they may be used)
  244. | `search` |Search api, Percolator api and Suggester api (e.g filters, script_fields)
  245. | `update` |Update api
  246. | `plugin` |Any plugin that makes use of scripts under the generic `plugin` category
  247. |=======================================================================
  248. Plugins can also define custom operations that they use scripts for instead
  249. of using the generic `plugin` category. Those operations can be referred to
  250. in the following form: `${pluginName}_${operation}`.
  251. The following example disables scripting for `update` and `mapping` operations,
  252. regardless of the script source, for any engine. Scripts can still be
  253. executed from sandboxed languages as part of `aggregations`, `search`
  254. and plugins execution though, as the above defaults still get applied.
  255. [source,yaml]
  256. -----------------------------------
  257. script.update: off
  258. script.mapping: off
  259. -----------------------------------
  260. Generic settings get applied in order, operation based ones have precedence
  261. over source based ones. Language specific settings are supported too. They
  262. need to be prefixed with the `script.engine.<engine>` prefix and have
  263. precedence over any other generic settings.
  264. [source,yaml]
  265. -----------------------------------
  266. script.engine.groovy.file.aggs: on
  267. script.engine.groovy.file.mapping: on
  268. script.engine.groovy.file.search: on
  269. script.engine.groovy.file.update: on
  270. script.engine.groovy.file.plugin: on
  271. script.engine.groovy.indexed.aggs: on
  272. script.engine.groovy.indexed.mapping: off
  273. script.engine.groovy.indexed.search: on
  274. script.engine.groovy.indexed.update: off
  275. script.engine.groovy.indexed.plugin: off
  276. script.engine.groovy.inline.aggs: on
  277. script.engine.groovy.inline.mapping: off
  278. script.engine.groovy.inline.search: off
  279. script.engine.groovy.inline.update: off
  280. script.engine.groovy.inline.plugin: off
  281. -----------------------------------
  282. [float]
  283. === Default Scripting Language
  284. The default scripting language (assuming no `lang` parameter is provided) is
  285. `groovy`. In order to change it, set the `script.default_lang` to the
  286. appropriate language.
  287. [float]
  288. === Automatic Script Reloading
  289. The `config/scripts` directory is scanned periodically for changes.
  290. New and changed scripts are reloaded and deleted script are removed
  291. from preloaded scripts cache. The reload frequency can be specified
  292. using `resource.reload.interval` setting, which defaults to `60s`.
  293. To disable script reloading completely set `script.auto_reload_enabled`
  294. to `false`.
  295. [[native-java-scripts]]
  296. [float]
  297. === Native (Java) Scripts
  298. Sometimes `groovy` and `expressions` aren't enough. For those times you can
  299. implement a native script.
  300. The best way to implement a native script is to write a plugin and install it.
  301. The plugin {plugins}/plugin-authors.html[documentation] has more information on
  302. how to write a plugin so that Elasticsearch will properly load it.
  303. To register the actual script you'll need to implement `NativeScriptFactory`
  304. to construct the script. The actual script will extend either
  305. `AbstractExecutableScript` or `AbstractSearchScript`. The second one is likely
  306. the most useful and has several helpful subclasses you can extend like
  307. `AbstractLongSearchScript`, `AbstractDoubleSearchScript`, and
  308. `AbstractFloatSearchScript`. Finally, your plugin should register the native
  309. script by declaring the `onModule(ScriptModule)` method.
  310. If you squashed the whole thing into one class it'd look like:
  311. [source,java]
  312. --------------------------------------------------
  313. public class MyNativeScriptPlugin extends Plugin {
  314. @Override
  315. public String name() {
  316. return "my-native-script";
  317. }
  318. @Override
  319. public String description() {
  320. return "my native script that does something great";
  321. }
  322. public void onModule(ScriptModule scriptModule) {
  323. scriptModule.registerScript("my_script", MyNativeScriptFactory.class);
  324. }
  325. public static class MyNativeScriptFactory implements NativeScriptFactory {
  326. @Override
  327. public ExecutableScript newScript(@Nullable Map<String, Object> params) {
  328. return new MyNativeScript();
  329. }
  330. @Override
  331. public boolean needsScores() {
  332. return false;
  333. }
  334. }
  335. public static class MyNativeScript extends AbstractFloatSearchScript {
  336. @Override
  337. public float runAsFloat() {
  338. float a = (float) source().get("a");
  339. float b = (float) source().get("b");
  340. return a * b;
  341. }
  342. }
  343. }
  344. --------------------------------------------------
  345. You can execute the script by specifying its `lang` as `native`, and the name
  346. of the script as the `id`:
  347. [source,js]
  348. --------------------------------------------------
  349. curl -XPOST localhost:9200/_search -d '{
  350. "query": {
  351. "function_score": {
  352. "query": {
  353. "match": {
  354. "body": "foo"
  355. }
  356. },
  357. "functions": [
  358. {
  359. "script_score": {
  360. "script": {
  361. "id": "my_script",
  362. "lang" : "native"
  363. }
  364. }
  365. }
  366. ]
  367. }
  368. }
  369. }'
  370. --------------------------------------------------
  371. [float]
  372. === Lucene Expressions Scripts
  373. experimental[The Lucene expressions module is undergoing significant development and the exposed functionality is likely to change in the future]
  374. Lucene's expressions module provides a mechanism to compile a
  375. `javascript` expression to bytecode. This allows very fast execution,
  376. as if you had written a `native` script. Expression scripts can be
  377. used in `script_score`, `script_fields`, sort scripts and numeric aggregation scripts.
  378. See the link:http://lucene.apache.org/core/4_9_0/expressions/index.html?org/apache/lucene/expressions/js/package-summary.html[expressions module documentation]
  379. for details on what operators and functions are available.
  380. Variables in `expression` scripts are available to access:
  381. * Single valued document fields, e.g. `doc['myfield'].value`
  382. * Single valued document fields can also be accessed without `.value` e.g. `doc['myfield']`
  383. * Parameters passed into the script, e.g. `mymodifier`
  384. * The current document's score, `_score` (only available when used in a `script_score`)
  385. Variables in `expression` scripts that are of type `date` may use the following member methods:
  386. * getYear()
  387. * getMonth()
  388. * getDayOfMonth()
  389. * getHourOfDay()
  390. * getMinutes()
  391. * getSeconds()
  392. The following example shows the difference in years between the `date` fields date0 and date1:
  393. `doc['date1'].getYear() - doc['date0'].getYear()`
  394. There are a few limitations relative to other script languages:
  395. * Only numeric fields may be accessed
  396. * Stored fields are not available
  397. * If a field is sparse (only some documents contain a value), documents missing the field will have a value of `0`
  398. [float]
  399. === Score
  400. In all scripts that can be used in aggregations, the current
  401. document's score is accessible in `_score`.
  402. [float]
  403. === Computing scores based on terms in scripts
  404. see <<modules-advanced-scripting, advanced scripting documentation>>
  405. [float]
  406. === Document Fields
  407. Most scripting revolve around the use of specific document fields data.
  408. The `doc['field_name']` can be used to access specific field data within
  409. a document (the document in question is usually derived by the context
  410. the script is used). Document fields are very fast to access since they
  411. end up being loaded into memory (all the relevant field values/tokens
  412. are loaded to memory). Note, however, that the `doc[...]` notation only
  413. allows for simple valued fields (can’t return a json object from it)
  414. and makes sense only on non-analyzed or single term based fields.
  415. The following data can be extracted from a field:
  416. [cols="<,<",options="header",]
  417. |=======================================================================
  418. |Expression |Description
  419. |`doc['field_name'].value` |The native value of the field. For example,
  420. if its a short type, it will be short.
  421. |`doc['field_name'].values` |The native array values of the field. For
  422. example, if its a short type, it will be short[]. Remember, a field can
  423. have several values within a single doc. Returns an empty array if the
  424. field has no values.
  425. |`doc['field_name'].empty` |A boolean indicating if the field has no
  426. values within the doc.
  427. |`doc['field_name'].multiValued` |A boolean indicating that the field
  428. has several values within the corpus.
  429. |`doc['field_name'].lat` |The latitude of a geo point type.
  430. |`doc['field_name'].lon` |The longitude of a geo point type.
  431. |`doc['field_name'].lats` |The latitudes of a geo point type.
  432. |`doc['field_name'].lons` |The longitudes of a geo point type.
  433. |`doc['field_name'].distance(lat, lon)` |The `plane` distance (in meters)
  434. of this geo point field from the provided lat/lon.
  435. |`doc['field_name'].distanceWithDefault(lat, lon, default)` |The `plane` distance (in meters)
  436. of this geo point field from the provided lat/lon with a default value.
  437. |`doc['field_name'].distanceInMiles(lat, lon)` |The `plane` distance (in
  438. miles) of this geo point field from the provided lat/lon.
  439. |`doc['field_name'].distanceInMilesWithDefault(lat, lon, default)` |The `plane` distance (in
  440. miles) of this geo point field from the provided lat/lon with a default value.
  441. |`doc['field_name'].distanceInKm(lat, lon)` |The `plane` distance (in
  442. km) of this geo point field from the provided lat/lon.
  443. |`doc['field_name'].distanceInKmWithDefault(lat, lon, default)` |The `plane` distance (in
  444. km) of this geo point field from the provided lat/lon with a default value.
  445. |`doc['field_name'].arcDistance(lat, lon)` |The `arc` distance (in
  446. meters) of this geo point field from the provided lat/lon.
  447. |`doc['field_name'].arcDistanceWithDefault(lat, lon, default)` |The `arc` distance (in
  448. meters) of this geo point field from the provided lat/lon with a default value.
  449. |`doc['field_name'].arcDistanceInMiles(lat, lon)` |The `arc` distance (in
  450. miles) of this geo point field from the provided lat/lon.
  451. |`doc['field_name'].arcDistanceInMilesWithDefault(lat, lon, default)` |The `arc` distance (in
  452. miles) of this geo point field from the provided lat/lon with a default value.
  453. |`doc['field_name'].arcDistanceInKm(lat, lon)` |The `arc` distance (in
  454. km) of this geo point field from the provided lat/lon.
  455. |`doc['field_name'].arcDistanceInKmWithDefault(lat, lon, default)` |The `arc` distance (in
  456. km) of this geo point field from the provided lat/lon with a default value.
  457. |`doc['field_name'].factorDistance(lat, lon)` |The distance factor of this geo point field from the provided lat/lon.
  458. |`doc['field_name'].factorDistance(lat, lon, default)` |The distance factor of this geo point field from the provided lat/lon with a default value.
  459. |`doc['field_name'].geohashDistance(geohash)` |The `arc` distance (in meters)
  460. of this geo point field from the provided geohash.
  461. |`doc['field_name'].geohashDistanceInKm(geohash)` |The `arc` distance (in km)
  462. of this geo point field from the provided geohash.
  463. |`doc['field_name'].geohashDistanceInMiles(geohash)` |The `arc` distance (in
  464. miles) of this geo point field from the provided geohash.
  465. |=======================================================================
  466. [float]
  467. === Stored Fields
  468. Stored fields can also be accessed when executing a script. Note, they
  469. are much slower to access compared with document fields, as they are not
  470. loaded into memory. They can be simply accessed using
  471. `_fields['my_field_name'].value` or `_fields['my_field_name'].values`.
  472. [float]
  473. === Accessing the score of a document within a script
  474. When using scripting for calculating the score of a document (for instance, with
  475. the `function_score` query), you can access the score using the `_score`
  476. variable inside of a Groovy script.
  477. [float]
  478. === Source Field
  479. The source field can also be accessed when executing a script. The
  480. source field is loaded per doc, parsed, and then provided to the script
  481. for evaluation. The `_source` forms the context under which the source
  482. field can be accessed, for example `_source.obj2.obj1.field3`.
  483. Accessing `_source` is much slower compared to using `doc`
  484. but the data is not loaded into memory. For a single field access `_fields` may be
  485. faster than using `_source` due to the extra overhead of potentially parsing large documents.
  486. However, `_source` may be faster if you access multiple fields or if the source has already been
  487. loaded for other purposes.
  488. [float]
  489. === Groovy Built In Functions
  490. There are several built in functions that can be used within scripts.
  491. They include:
  492. [cols="<,<",options="header",]
  493. |=======================================================================
  494. |Function |Description
  495. |`sin(a)` |Returns the trigonometric sine of an angle.
  496. |`cos(a)` |Returns the trigonometric cosine of an angle.
  497. |`tan(a)` |Returns the trigonometric tangent of an angle.
  498. |`asin(a)` |Returns the arc sine of a value.
  499. |`acos(a)` |Returns the arc cosine of a value.
  500. |`atan(a)` |Returns the arc tangent of a value.
  501. |`toRadians(angdeg)` |Converts an angle measured in degrees to an
  502. approximately equivalent angle measured in radians
  503. |`toDegrees(angrad)` |Converts an angle measured in radians to an
  504. approximately equivalent angle measured in degrees.
  505. |`exp(a)` |Returns Euler's number _e_ raised to the power of value.
  506. |`log(a)` |Returns the natural logarithm (base _e_) of a value.
  507. |`log10(a)` |Returns the base 10 logarithm of a value.
  508. |`sqrt(a)` |Returns the correctly rounded positive square root of a
  509. value.
  510. |`cbrt(a)` |Returns the cube root of a double value.
  511. |`IEEEremainder(f1, f2)` |Computes the remainder operation on two
  512. arguments as prescribed by the IEEE 754 standard.
  513. |`ceil(a)` |Returns the smallest (closest to negative infinity) value
  514. that is greater than or equal to the argument and is equal to a
  515. mathematical integer.
  516. |`floor(a)` |Returns the largest (closest to positive infinity) value
  517. that is less than or equal to the argument and is equal to a
  518. mathematical integer.
  519. |`rint(a)` |Returns the value that is closest in value to the argument
  520. and is equal to a mathematical integer.
  521. |`atan2(y, x)` |Returns the angle _theta_ from the conversion of
  522. rectangular coordinates (_x_, _y_) to polar coordinates (r,_theta_).
  523. |`pow(a, b)` |Returns the value of the first argument raised to the
  524. power of the second argument.
  525. |`round(a)` |Returns the closest _int_ to the argument.
  526. |`random()` |Returns a random _double_ value.
  527. |`abs(a)` |Returns the absolute value of a value.
  528. |`max(a, b)` |Returns the greater of two values.
  529. |`min(a, b)` |Returns the smaller of two values.
  530. |`ulp(d)` |Returns the size of an ulp of the argument.
  531. |`signum(d)` |Returns the signum function of the argument.
  532. |`sinh(x)` |Returns the hyperbolic sine of a value.
  533. |`cosh(x)` |Returns the hyperbolic cosine of a value.
  534. |`tanh(x)` |Returns the hyperbolic tangent of a value.
  535. |`hypot(x, y)` |Returns sqrt(_x2_ + _y2_) without intermediate overflow
  536. or underflow.
  537. |=======================================================================