# Search operators

FuseQL search operators enable both regular and advanced log search (after you choose the **Advanced Search** option). The language specifies the following syntactical rules:

- The search operator must appear before the first pipe (`|`) symbol in the query expression.
- All other operators must follow a valid search expression.

## and

[and](https://docs.kloudfuse.com/platform/4.0.2/query-languages/fuseql/search-operators/#and)

Intersection operator (AND logic) between two search operators. Selects results that satisfy both conditions.

### Syntax

There is a difference in syntax for the operator between regular search and advanced search.

- Regular search

```none
  facetName1="value1" facetName2="value2"
  ```

- Advanced search

```none
  @facetName1="value1" and @facetName2="value2"
  ```

### Example

- Regular search

```none
  level="info" header="map"
  ```

- Advanced search

```none
  @level="info" and @header="map"
  ```

## or

[or](https://docs.kloudfuse.com/platform/4.0.2/query-languages/fuseql/search-operators/#or)

Union operator (OR logic) between two search operators. Selects results that satisfy either or both conditions.

### Syntax

There is a difference in syntax for the operator between regular search and advanced search.

- Regular search

```none
  @facet="valueA OR valueB"
  ```

- Advanced search

```none
  @facet="valueA" or @facet="valueB"
  ```

### Example

- Regular search

```none
  level="info OR warning"
  ```

- Advanced search

```none
  @level="info" or @level="warning"
  ```

## equal, `=`

Searches for specified value; exact match.

### Syntax

```none
label="value"
@facetName="value“
```

### Example

```none
@http_request_method="POST" and source="nginx"
```

## not equal, `!=`

Searches for values _**other**_ than the specified value; exact match.

### Syntax

```none
label!="value"
@facetName!="value“
```

### Example

```none
@facetName!="pinot-server" and level!="info"
```

## greater than, `>`

Searches for values that are greater than the specified number.

### Syntax

```none
@facetName>number
```

### Example

```none
@status_1>300 and source="logs-query-service"
```

## greater than or equal, `>=`

Searches for values that are greater than or equal to the specified number.

### Syntax

```none
@facetName>=number
```

### Example

```none
@status_1>=200 and source="logs-query-service"
```

## less than, `<`

Searches for values that are less than the specified number.

### Syntax

```none
@facetName<number
```

### Example

```none
@status_1<500 and source="logs-query-service"
```

## less than or equal, `<=`

Searches for values that are less than or equal to the specified number.

### Syntax

```none
@facetName<=number
```

### Example

```none
@status_1<=700 and source="logs-query-service"
```

## regex, `=~`

Searches for results that match a specific character pattern.

### Syntax

```none
label=~"value"
@facetName=~"value“
```

### Example

```none
availability_zone=~"us" and @partition=~"metadata"
```

## not regex, `!~`

Searches for results that **_do not_** match a specific character pattern.

### Syntax

```none
label!~"value"
@facetName!~"value“
```

### Example

```none
availability_zone=~"west" and @partition=!~"metadata"
```

## terms exist, `term`

Matches complete tokens in the log message body. Terms are based on the tokenized words in the message body. All terms must appear in the log line, in any order. Fast and inexpensive.

### Syntax

```none
token1 token2 token3
```

### Example

```none
container
```

## not terms exist, `!term`

Excludes log lines that match complete tokens. Terms are determined by tokenization. All terms must appear in the log line, in any order, for the line to be excluded.

### Syntax

```none
!term
```

### Example

```none
!container
```

## grep, `"grep"`

Searches for a literal, case-sensitive substring in the log message body. Unlike `term`, this matches character sequences rather than whole tokens, so it can match partial words and phrases.

### Syntax

```none
"expression"
```

### Example

```none
"forward NR traces payload"
```

## not grep, `!"grep"`

Excludes log lines containing a literal, case-sensitive substring in the log message body.

### Syntax

```none
!"expression"
```

### Example

```none
!"forward NR traces payload"
```

## facet terms exist, `==`

Searches to match a specific facet and its value.

### Syntax

```none
@facet=="value"
```

### Example

```none
@traceFlags=="1"
```

## facet terms not exist, `!==`

Searches to exclude a specific facet and its value.

### Syntax

```none
@facet!="value"
```

### Example

```none
@traceFlags!="1"
```

## starts with, `*~`

Searches for labels or facets where the value begins with the specified string.

### Syntax

```none
label*="value"
@facet*="value"
```

### Example

```none
kube_container_name*~"recommendation" and @trace_sampled*~"T"
```

## ends with, `~*`

Searches for labels or facets where the value ends with the specified string.

### Syntax

```none
label~*="value"
@facet~*="value"
```

### Example

```none
@resource_service_name~*"service" and agent~*"dog"
```

## contains, `**`

Searches for labels or facets where the value contains the specified string.

### Syntax

```none
label**"value"
@facet**"value"
```

### Example

```none
@ids**"9SIQT8TOJO" and kube_deployment**"otel"
```

## key exists

Searches for the presence of a specific facet, regardless of its value.

### Syntax

There is a difference in syntax for the operator between regular search and advanced search.

- Regular search

```none
  key exists = "facet"
  ```

- Advanced search

```none
  @facet
  ```

### Example

- Regular search

```none
  key exists="user_agent_original"
  ```

- Advanced search

```none
  @user_agent_original
  ```
