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

# Comments search

The comment search API lets you find, filter, and analyze comments or notes attached to tickets or other entities using flexible Typesense-powered queries. You can search by text, filter by any comment property, and select exactly which fields you want in the response.

> **Note:** Fallback search mode is not supported for comments. Only primary search mode is available.

## Example use cases

* **Get all comments for a specific ticket**

  ```json theme={null}
  {
    "query_by": "content",
    "filter_by": "ticket_id:=TICKET123",
    "q": "*"
  }
  ```

* **Find comments created by a specific user**

  ```json theme={null}
  {
    "query_by": "content",
    "filter_by": "created_by_email:=user@company.com",
    "q": "*"
  }
  ```

* **List all pinned comments in the last 7 days**

  ```json theme={null}
  {
    "query_by": "content",
    "filter_by": "is_pinned:=true&&created_at:>2024-05-01",
    "q": "*"
  }
  ```

* **Get comments containing the word 'urgent'**

  ```json theme={null}
  {
    "query_by": "content",
    "q": "urgent"
  }
  ```

* **Find edited comments for a specific team**

  ```json theme={null}
  {
    "query_by": "content",
    "filter_by": "team_uid:=T88S900BHN&&is_edited:=true",
    "q": "*"
  }
  ```

***

## Comment search response fields

Below are all the fields you may see in a comment search result. Many are optional and will only appear if included in your `include_fields` parameter.

| Field               | Type    | Description                      |
| ------------------- | ------- | -------------------------------- |
| ticket\_id          | string  | Ticket ID the comment belongs to |
| content             | string  | Comment content                  |
| created\_at         | string  | Creation timestamp (ISO8601)     |
| updated\_at         | string  | Last update timestamp (ISO8601)  |
| created\_by\_id     | string  | Creator's user ID                |
| created\_by\_email  | string  | Creator's email                  |
| created\_by\_name   | string  | Creator's name                   |
| team\_uid           | string  | Team UID                         |
| team\_identifier    | string  | Team identifier                  |
| ticket\_ticket\_id  | string  | Ticket's ticket ID               |
| comment\_type       | string  | Type of comment                  |
| comment\_visibility | string  | Comment visibility               |
| is\_edited          | boolean | Whether the comment was edited   |
| is\_pinned          | boolean | Whether the comment is pinned    |
| content\_markdown   | string  | Markdown content                 |
| content\_html       | string  | HTML content                     |
| organization\_id    | string  | Organization ID                  |
| ticket\_identifier  | string  | Ticket identifier                |
| ticket\_uid         | string  | Ticket UID                       |
| organization\_uid   | string  | Organization UID                 |

> For a full list, see the CommentSearchResponseDto in the API reference.

***

**Tip:** Use the `include_fields` parameter to limit the response to only the fields you need for performance and clarity.

## Notes

* The `document` in each hit will match the schema for the selected collection (Ticket, Account, or Comment).
* Field names in query parameters can be provided in camelCase and will be mapped to the correct Typesense field names automatically.
* Filtering and sorting support all Typesense operators and syntax.
* Only authorized users can access this endpoint; results are scoped to the user's organization and teams.

For more details on available fields and advanced search options, refer to the [Typesense documentation](https://typesense.org/docs/0.24.0/api/documents.html#search-documents) or your collection's schema.
