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