---
id: searching_messages
sidebar_position: 20
title: Searching Messages
---

Searching For Messages Across Channels

Message search is built-in to the chat API. You can enable and/or disable the search indexing on a per channel type.
The command shown below selects the channels in which John is a member.
Next, it searches the messages in those channels for the keyword “'supercalifragilisticexpialidocious'”:

```dart
final search = await client.search(
    Filter.in_('members', ['john']),
    query: 'supercalifragilisticexpialidocious',
    paginationParams: PaginationParams(
        limit: 2,
        offset: 0
    ),
);
```

Pagination works via the standard limit and offset parameters. The first argument, filter, uses a MongoDB style query expression.

We do not run MongoDB on the backend, so only a subset of the standard MongoDB filters are supported.
Additionally, this endpoint can be used to search for messages that have attachments.

```dart
// Search file of type videos
  final response = await channel.search(messageFilter: Filter.in_('attachments.type', ['video']));
  return response;
```