# ES|QL Operators

ES|QL supports a variety of operators that can be used in queries. These operators can be categorized into binary operators, unary operators, logical operators, and others.

## Binary Operators

Binary operators in ES|QL include equality, inequality, less than, less than or equal to, greater than, greater than or equal to, add, subtract, multiply, divide, and modulus.

### Equality

The equality operator (`==`) checks if two values are equal. 

```esql
FROM employees
| WHERE first_name == "John"
```

### Inequality

The inequality operator (`!=`) checks if two values are not equal.

```esql
FROM employees
| WHERE salary != 50000
```

### Less Than

The less than operator (`<`) checks if one value is less than another.

```esql
FROM employees
| WHERE age < 30
```

### Less Than or Equal To

The less than or equal to operator (`<=`) checks if one value is less than or equal to another.

```esql
FROM employees
| WHERE years_of_experience <= 5
```

### Greater Than

The greater than operator (`>`) checks if one value is greater than another.

```esql
FROM employees
| WHERE salary > 50000
```

### Greater Than or Equal To

The greater than or equal to operator (`>=`) checks if one value is greater than or equal to another.

```esql
FROM employees
| WHERE age >= 30
```

### Add

The add operator (`+`) adds two values together.

```esql
FROM employees
| EVAL total_compensation = salary + bonus
```

### Subtract

The subtract operator (`-`) subtracts one value from another.

```esql
FROM employees
| EVAL years_until_retirement = 65 - age
```

### Multiply

The multiply operator (`*`) multiplies two values.

```esql
FROM employees
| EVAL yearly_bonus = monthly_bonus * 12
```

### Divide

The divide operator (`/`) divides one value by another.

```esql
FROM employees
| EVAL hourly_wage = salary / 2080
```

### Modulus

The modulus operator (`%`) returns the remainder of a division operation.

```esql
FROM employees
| EVAL odd_or_even = employee_id % 2
```

## Unary Operators

ES|QL supports one unary operator, negation (`-`), which negates a value.

```esql
FROM employees
| EVAL negative_salary = -salary
```

## Logical Operators

ES|QL supports the logical operators `AND`, `OR`, and `NOT`.

```esql
FROM employees
| WHERE salary > 50000 AND years_of_experience <= 5
```

## Other Operators

### IS NULL and IS NOT NULL

The `IS NULL` and `IS NOT NULL` predicates check if a value is null or not null, respectively.

```esql
FROM employees
| WHERE birth_date IS NULL
```

### Cast (::)

The `::` operator provides a convenient alternative syntax to the `TO_<type>` conversion functions.

```esql
ROW ver = CONCAT(("0"::INT + 1)::STRING, ".2.3")::VERSION
```

### IN

The `IN` operator checks if a field or expression equals an element in a list of literals, fields, or expressions.

```esql
ROW a = 1, b = 4, c = 3
| WHERE c-a IN (3, b / 2, a)
```

### LIKE

The `LIKE` operator filters data based on string patterns using wildcards.

```esql
FROM employees
| WHERE first_name LIKE "?b*"
```

### RLIKE

The `RLIKE` operator filters data based on string patterns using regular expressions.

```esql
FROM employees
| WHERE first_name RLIKE ".leja.*"
```