﻿---
title: Operators
description: An operator is the most basic action that can be taken to evaluate values in a script. An expression is one-to-many consecutive operations. Precedence...
url: https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators
products:
  - Painless
---

# Operators
An operator is the most basic action that can be taken to evaluate values in a script. An expression is one-to-many consecutive operations. Precedence is the order in which an operator will be evaluated relative to another operator. Associativity is the direction within an expression in which a specific operator is evaluated. The following table lists all available operators:

| **Operator**Operator                                                                                                                                                              | **Category**Category                                                                                                                                            | **Symbol(s)**Symbol(s) | **Precedence**Precedence | **Associativity**Associativity |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|--------------------------|--------------------------------|
| [Precedence](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general#precedence-operator)Precedence                                  | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | ()                     | 0                        | left → right                   |
| [Method Call](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#method-call-operator)Method Call                             | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | . ()                   | 1                        | left → right                   |
| [Field Access](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#field-access-operator)Field Access                          | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | .                      | 1                        | left → right                   |
| [Null Safe](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#null-safe-operator)Null Safe                                   | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | ?.                     | 1                        | left → right                   |
| [Function Call](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general#function-call-operator)Function Call                         | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | ()                     | 1                        | left → right                   |
| [Array Initialization](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array#array-initialization-operator)Array Initialization      | [Array](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array)Array             | [] {}                  | 1                        | left → right                   |
| [Array Access](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array#array-access-operator)Array Access                              | [Array](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array)Array             | []                     | 1                        | left → right                   |
| [Array Length](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array#array-length-operator)Array Length                              | [Array](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array)Array             | .                      | 1                        | left → right                   |
| [List Initialization](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#list-initialization-operator)List Initialization     | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | []                     | 1                        | left → right                   |
| [List Access](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#list-access-operator)List Access                             | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | []                     | 1                        | left → right                   |
| [Map Initialization](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#map-initialization-operator)Map Initialization        | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | [:]                    | 1                        | left → right                   |
| [Map Access](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#map-access-operator)Map Access                                | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | []                     | 1                        | left → right                   |
| [Post Increment](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#post-increment-operator)Post Increment                      | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | ++                     | 1                        | left → right                   |
| [Post Decrement](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#post-decrement-operator)Post Decrement                      | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | —                      | 1                        | left → right                   |
| [Pre Increment](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#pre-increment-operator)Pre Increment                         | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | ++                     | 2                        | right → left                   |
| [Pre Decrement](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#pre-decrement-operator)Pre Decrement                         | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | —                      | 2                        | right → left                   |
| [Unary Positive](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#unary-positive-operator)Unary Positive                      | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | +                      | 2                        | right → left                   |
| [Unary Negative](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#unary-negative-operator)Unary Negative                      | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | -                      | 2                        | right → left                   |
| [Boolean Not](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#boolean-not-operator)Boolean Not                               | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | !                      | 2                        | right → left                   |
| [Bitwise Not](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#bitwise-not-operator)Bitwise Not                               | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | ~                      | 2                        | right → left                   |
| [Cast](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general#cast-operator)Cast                                                    | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | ()                     | 3                        | right → left                   |
| [New Instance](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#new-instance-operator)New Instance                          | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | new ()                 | 3                        | right → left                   |
| [New Array](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array#new-array-operator)New Array                                       | [Array](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-array)Array             | new []                 | 3                        | right → left                   |
| [Multiplication](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#multiplication-operator)Multiplication                      | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | *                      | 4                        | left → right                   |
| [Division](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#division-operator)Division                                        | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | /                      | 4                        | left → right                   |
| [Remainder](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#remainder-operator)Remainder                                     | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | %                      | 4                        | left → right                   |
| [String Concatenation](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#string-concatenation-operator)String Concatenation  | [Reference](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference)Reference | +                      | 5                        | left → right                   |
| [Addition](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#addition-operator)Addition                                        | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | +                      | 5                        | left → right                   |
| [Subtraction](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#subtraction-operator)Subtraction                               | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | -                      | 5                        | left → right                   |
| [Left Shift](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#left-shift-operator)Left Shift                                  | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | <<                     | 6                        | left → right                   |
| [Right Shift](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#right-shift-operator)Right Shift                               | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | >>                     | 6                        | left → right                   |
| [Unsigned Right Shift](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#unsigned-right-shift-operator)Unsigned Right Shift    | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | >>>                    | 6                        | left → right                   |
| [Greater Than](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#greater-than-operator)Greater Than                            | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | >                      | 7                        | left → right                   |
| [Greater Than Or Equal](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#greater-than-or-equal-operator)Greater Than Or Equal | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | >=                     | 7                        | left → right                   |
| [Less Than](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#less-than-operator)Less Than                                     | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | <                      | 7                        | left → right                   |
| [Less Than Or Equal](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#less-than-or-equal-operator)Less Than Or Equal          | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | <=                     | 7                        | left → right                   |
| [Instanceof](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#instanceof-operator)Instanceof                                  | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | instanceof             | 8                        | left → right                   |
| [Equality Equals](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#equality-equals-operator)Equality Equals                   | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | ==                     | 9                        | left → right                   |
| [Equality Not Equals](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#equality-not-equals-operator)Equality Not Equals       | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | !=                     | 9                        | left → right                   |
| [Identity Equals](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#identity-equals-operator)Identity Equals                   | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | ===                    | 9                        | left → right                   |
| [Identity Not Equals](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#identity-not-equals-operator)Identity Not Equals       | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | !==                    | 9                        | left → right                   |
| [Bitwise And](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#bitwise-and-operator)Bitwise And                               | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | &                      | 10                       | left → right                   |
| [Boolean Xor](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#boolean-xor-operator)Boolean Xor                               | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | ^                      | 11                       | left → right                   |
| [Bitwise Xor](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#bitwise-xor-operator)Bitwise Xor                               | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       | ^                      | 11                       | left → right                   |
| [Bitwise Or](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric#bitwise-or-operator)Bitwise Or                                  | [Numeric](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-numeric)Numeric       |                        | 12                       | left → right                   |
| [Boolean And](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#boolean-and-operator)Boolean And                               | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       | &&                     | 13                       | left → right                   |
| [Boolean Or](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean#boolean-or-operator)Boolean Or                                  | [Boolean](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-boolean)Boolean       |                        | 14                       | left → right                   |
| [Conditional](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general#conditional-operator)Conditional                               | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | ? :                    | 15                       | right → left                   |
| [Elvis](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-reference#elvis-operator)Elvis                                               | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | ?:                     | 16                       | right → left                   |
| [Assignment](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general#assignment-operator)Assignment                                  | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | =                      | 17                       | right → left                   |
| [Compound Assignment](/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general#compound-assignment-operator)Compound Assignment       | [General](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/130564/reference/scripting-languages/painless/painless-operators-general)General       | $=                     | 17                       | right → left                   |