> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/api/guides/knowledge-graph/filtering.md).

# Filtering

You can narrow down the contents of a collection field using one or more filter arguments. a community that has name **Business Analysts Community**:

```graphql
query {
    communities (where: {name: {eq: "Business Analysts Community"}}) {
        id
        name
    }
}
```

The available operators depend on the field type. You can find the complete list of filter operators in the [Filter operators](/api/guides/knowledge-graph/filtering/filter-operators.md) section.

To combine multiple filters, put them next to one another. All such filters are related to one another using the implicit boolean `AND` operator. The following example is a query for communities that have been created by a user with the first name **Admin** and the last name **Istrator**:

```graphql
query {
    communities(
        where: {
            createdBy: { firstName: { eq: "Admin" }, lastName: { eq: "Istrator" } }
        }
    ) {
        id
        name
    }
}
```

You can also combine multiple filters or alter the filtering logic by explicitly using one of the boolean operators: `AND` or `OR`. This example is the equivalent the query above:

```graphql
query {
    communities(
        where: {
            createdBy: {
                _and: [{ firstName: { eq: "Admin" } }, { lastName: { eq: "Istrator" } }]
            }
        }
    ) {
        id
        name
    }
}
```

The same rules apply to the usage of the `OR` filter. The following example is a query for communities that have been created by a user whose first name is either **Admin** or contains the letter **S**:

```graphql
query {
    communities(
        where: {
            createdBy: {
                _or: [{ firstName: { eq: "Admin" } }, { firstName: { contains: "S" } }]
            }
        }
    ) {
        id
        name
        createdBy {
            fullName
        }
    }
}
```

To combine operators or to use filtering on the same field more then once, you must explicitly provide the boolean operators:

```graphql
query {
    communities(
        where: {
            _and: [
                {_or: [{name: {contains: "Data"}}, {description: {contains: "Data"}}]}
                {system: false}
            ]
        }
    ) {
        id
        name
        description
        system
    }
}
```

```graphql
query {
    communities(
        where: {
            _and: [
                {name: {endsWith: "Blocks"}}
                {name: {contains: "building"}}
            ]
        }
    ) {
        id
        name
    }
}
```

Filtering is not limited to the queried entity but you can also filter on the fields of related entities. The following query retrieves assets from domains that belong to the **Finance**:

```graphql
query {
    assets(where: {
        domain: {
            parent: {
                name : {eq: "Finance"}
            }
        }
    }) {
        fullName
    }
}
```

{% hint style="danger" %}
Due to technical limitations not all of those rules apply to **stringValues** of **MultiValueAttributes**. When filtering, use either the `contains` operator to match a single value, or `eq` separated by semicolon to match all of them:

```graphql
query {
    assets(where: {multiValueAttributes: {any: {stringValues: {contains: "Success"}}}}) {
        id
        fullName
        multiValueAttributes {
            stringValues
        }
    }
}
```

```graphql
query {
    assets(where: {multiValueAttributes: {any: {stringValues: {eq: "Failed;Success"}}}}) {
        id
        fullName
        multiValueAttributes {
            stringValues
        }
    }
}
```

{% endhint %}
