---
slug: /filter-operators-of-api
---

# Operators

Operators are used to connect operands or parameters and return results. In terms of syntax, operators can appear before, after, or between operands.

## Operator examples

### Data filtering (where)

#### Equal to

Use `$eq` to indicate equal to, as shown in the following example:

```python
where={"category": {"$eq": "AI"}}
```

#### Not equal to

Use `$ne` to indicate not equal to, as shown in the following example:

```python
where={"status": {"$ne": "deleted"}}
```

#### Greater than

Use `$gt` to indicate greater than, as shown in the following example:

```python
where={"score": {"$gt": 90}}
```

#### Greater than or equal to

Use `$gte` to indicate greater than or equal to, as shown in the following example:

```python
where={"score": {"$gte": 90}}
```

#### Less than

Use `$lt` to indicate less than, as shown in the following example:

```python
where={"score": {"$lt": 50}}
```

#### Less than or equal to

Use `$lte` to indicate less than or equal to, as shown in the following example:

```python
where={"score": {"$lte": 50}}
```

#### Contains

Use `$in` to indicate contains, as shown in the following example:

```python
where={"tag": {"$in": ["ml", "python", "ai"]}}
```

#### Does not contain

Use `$nin` to indicate does not contain, as shown in the following example:

```python
where={"tag": {"$nin": ["deprecated", "old"]}}
```

#### Logical OR

Use `$or` to indicate logical OR, as shown in the following example:

```python
where={
    "$or": [
        {"category": {"$eq": "AI"}},
        {"tag": {"$eq": "python"}}
    ]
}
```

#### Logical AND

Use `$and` to indicate logical AND, as shown in the following example:

```python
where={
    "$and": [
        {"category": {"$eq": "AI"}},
        {"score": {"$gte": 90}}
    ]
}
```

### Text filtering (where_document)

#### Full-text search (contains substring)

Use `$contains` to indicate full-text search, as shown in the following example:

```python
where_document={"$contains": "machine learning"}
```

#### Regular expression

Use `$regex` to indicate regular expression, as shown in the following example:

```python
where_document={"$regex": "pattern.*"}
```

#### Logical OR

Use `$or` to indicate logical OR, as shown in the following example:

```python
where_document={
    "$or": [
        {"$contains": "machine learning"},
        {"$contains": "artificial intelligence"}
    ]
}
```

#### Logical AND

Use `$and` to indicate logical AND, as shown in the following example:

```python
where_document={
    "$and": [
        {"$contains": "machine"},
        {"$contains": "learning"}
    ]
}
```

## Related operations

* [Vector query](200.query-interfaces-of-api.md)
* [get - Retrieve](300.get-interfaces-of-api.md)
* [Hybrid search](400.hybrid-search-of-api.md)
