> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mossdesk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# search

> Full-text search across contacts, companies, deals, and interactions.

Search lets you find anything in your CRM with a single query. It searches across contacts, companies, deals, and interactions using PostgreSQL full-text search.

## moss search

Search across all entity types.

```bash theme={null}
moss search --q "acme enterprise"
```

```bash theme={null}
moss search --q "jane" --types contacts,deals --per-type 10
```

| Option            | Required | Description                                                                                             |
| ----------------- | -------- | ------------------------------------------------------------------------------------------------------- |
| `--q <query>`     | Yes      | Search query                                                                                            |
| `--types <types>` | No       | Comma-separated entity types to search: `contacts`, `companies`, `deals`, `interactions` (default: all) |
| `--per-type <n>`  | No       | Maximum results per type (default: 5, max: 20)                                                          |

### JSON output

```bash theme={null}
moss search --q "acme" --json
```

```json theme={null}
{
  "data": {
    "contacts": [
      { "id": "cnt_abc123", "first_name": "Jane", "last_name": "Smith", "email": "jane@acme.com" }
    ],
    "companies": [
      { "id": "cmp_abc123", "name": "Acme Corp", "domain": "acme.com" }
    ],
    "deals": [
      { "id": "deal_abc123", "name": "Acme Corp - Enterprise", "stage": "proposal" }
    ],
    "interactions": []
  }
}
```

Results are ranked by relevance using PostgreSQL `tsvector` full-text search with GIN indexes.
