Overview
The Search Service provides unified search capabilities across all content in Macro. It indexes documents, emails, channel messages, and projects in OpenSearch and provides fast, relevant search results with filtering and pagination. Base URL:/search
Authentication: JWT authentication required via the Authorization header.
Core Concepts
Unified Search
Unified search queries across all content types simultaneously:- Documents
- Email threads and messages
- Channel messages
- Projects/folders
Simple Search
Simple search endpoints provide type-specific search with simpler query syntax and filters.Search Indexing
Content is indexed asynchronously:- Service sends events to SQS queue when content changes
- Search processing service extracts and indexes content
- OpenSearch makes content searchable (typically within seconds)
Unified Search
Search All Content
Array of search terms/keywords
Content types to search:
documents, emails, channels, projects, chatsAdditional filters (date range, owner, etc.)
Number of results per page (default: 10, max: 100)
Base64-encoded pagination cursor from previous response
Array of search result items from all content types
Cursor for next page of results (null if no more results)
Results are enriched with metadata from respective services (document names, email subjects, channel names) before being returned. Empty or deleted items are filtered out.
Simple Search
Simple search endpoints provide type-specific search with straightforward query syntax.Search Documents
Search query string
Document-specific filters
Filter to specific project
Filter to specific owner
Filter to documents created after date
Results per page
Pagination cursor
Array of document search results
Next page cursor
Search Emails
Search query
Email filters
Filter by sender email
Filter by recipient email
Filter to emails with attachments
Filter to unread emails
Search Channels
Search query
Channel filters
Filter to specific channel
Filter by message sender
Search Projects
Search query
Filter by project owner
Search Chats
Search query
Search Features
Query Syntax
The unified search supports: Basic queries:- Single terms:
roadmap - Multiple terms:
["product", "roadmap"](matches documents with both) - Phrases: Use multiple terms for phrase-like matching
- Date ranges
- Content type restrictions
- Owner/creator filters
- Project/folder filters
Ranking
Results are ranked by:- Relevance score - How well the content matches the query
- Recency - More recent content ranks higher
- User activity - Frequently accessed items rank higher
updated_at after type-specific ranking.
Result Enrichment
Raw OpenSearch results are enriched with metadata:- Document names and owners
- Email subjects and senders
- Channel names
- Project hierarchy
Error Codes
Common Errors
200- Success400- Bad Request (invalid query syntax)401- Unauthorized500- Internal Server Error503- Service Unavailable (OpenSearch down)
Service-Specific Errors
INVALID_QUERY- Query syntax is invalidINVALID_CURSOR- Pagination cursor is malformed or expiredSEARCH_TIMEOUT- Query took too long to executeINDEX_NOT_READY- Search index is still building