OpenSearch/docs/reference/modules/scripting
Nik Everett 3a7a218e8f Support negative array ofsets in painless
Adds support for indexing into lists and arrays with negative
indexes meaning "counting from the back". So for if
`x = ["cat", "dog", "chicken"]` then `x[-1] == "chicken"`.

This adds an extra branch to every array and list access but
some performance testing makes it look like the branch predictor
successfully predicts the branch every time so there isn't a
in execution time for this feature when the index is positive.
When the index is negative performance testing showed the runtime
is the same as writing `x[x.length - 1]`, again, presumably thanks
to the branch predictor.

Those performance metrics were calculated for lists and arrays but
`def`s get roughly the same treatment though instead of inlining
the test they need to make a invoke dynamic so we don't screw up
maps.

Closes #20870
2016-10-29 16:12:40 -04:00
..
advanced-scripting.asciidoc Reorganise scripting docs (#18132) 2016-05-04 18:17:10 +02:00
expression.asciidoc improve date api for expressions/painless fields 2016-05-31 09:32:33 -04:00
fields.asciidoc Renamed all AUTOSENSE snippets to CONSOLE (#18210) 2016-05-09 15:42:23 +02:00
groovy.asciidoc Deprecate Groovy, Python, and Javascript scripts. 2016-08-30 09:06:18 -07:00
native.asciidoc Remove LeafSearchScript.runAsFloat(): Nothing calls it. 2016-05-15 22:59:28 -04:00
painless-syntax.asciidoc Support negative array ofsets in painless 2016-10-29 16:12:40 -04:00
painless.asciidoc Disable regexes by default in painless 2016-09-12 14:09:43 -04:00
security.asciidoc Docs: Replace [source,json] with [source,js] 2016-05-24 11:17:27 -04:00
using.asciidoc Fixed typos (#20843) 2016-10-10 14:51:47 -06:00