#### Scripting Help

By default, Elasticsearch scripts use Lucene Expressions , which is a lot like JavaScript, but limited to basic arithmetic, bitwise and comparison operations. We'll let you do some reading on Lucene Expressions To access values in the document use the following format:

`doc['some_field'].value`

There are a few limitations when using Lucene Expressions:

- Only numeric fields may be accessed
- Stored fields are not available
- If a field is sparse (only some documents contain a value), documents missing the field will have a value of 0

Here are all the operations available to scripted fields:

- Arithmetic operators: + - * / %
- Bitwise operators: | & ^ ~ << >> >>>
- Boolean operators (including the ternary operator): && || ! ?:
- Comparison operators: < <= == >= >
- Common mathematic functions: abs ceil exp floor ln log10 logn max min sqrt pow
- Trigonometric library functions: acosh acos asinh asin atanh atan atan2 cosh cos sinh sin tanh tan
- Distance functions: haversin
- Miscellaneous functions: min, max