> 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.collibra.com/api/guides/knowledge-graph/filtering.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
