- [HTTP request](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#body.aspect_1)
- [QueryDialect](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#QueryDialect)

**Full name**: projects.locations.instances.search

Initiates a long-running search operation.

### HTTP request

`POST https://{endpoint}/v1alpha/{parent}:search`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/chronicle/docs/reference/rest#rest_endpoints).

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The resource name of the instance on which to perform the search. Format: projects/{project}/locations/{location}/instances/{instance} |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "query": string, "timeRange": { object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/Interval`) }, "dialect": enum (`https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#QueryDialect`), "draftDataAccessScope": { object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.dataAccessScopes#DataAccessScope`) }, "resultLimit": integer, "simulatedDataVisibility": enum (`https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.dashboardScheduledReports#SimulatedDataVisibility`) } ``` |

| Fields ||
|---|---|
| `query` | `string` Required. The YL2/SQL query used for searching. Example: 'ip=/172.\*/ AND metadata.event_type!="NETWORK_CONNECTION" AND ( target.ip = "3.225.179.73" OR target.ip = "23.47.48.70")' |
| `timeRange` | ``object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/Interval`)`` Required. Time range to search for \[Inclusive start time, exclusive end time). |
| `dialect` | ``enum (`https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances/search#QueryDialect`)`` Optional. Specifies the dialect the instances.search Query is written in. If not specified, the query will be parsed as YL2. |
| `draftDataAccessScope` | ``object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.dataAccessScopes#DataAccessScope`)`` Optional. Data access scope used to filter events. This is intended to be used by admins to preview in-development scopes. Should only be called by users with global access. If the caller does not have global access, the request will fail. |
| `resultLimit` | `integer` Optional. Requested maximum number of rows to materialize. The service may return fewer. If unspecified, a server-side default of 10,000 is used. The maximum value is 1,000,000. |
| `simulatedDataVisibility` | ``enum (`https://docs.cloud.google.com/chronicle/docs/reference/rest/v1alpha/projects.locations.instances.dashboardScheduledReports#SimulatedDataVisibility`)`` Optional. Specifies visibility of simulated data to include in search results. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `
  https://www.googleapis.com/auth/chronicle`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `chronicle.searchSessions.search`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## QueryDialect

Specifies the dialect the instances.search Query is written in.

| Enums ||
|---|---|
| `QUERY_DIALECT_UNSPECIFIED` | Defaults to YL2. |
| `YL2` | YL2 query dialect. |
| `SQL` | SQL query dialect. |
| `RAW_LOG` | Raw Log instances.search dialect. `query` uses the raw log search grammar (e.g. `raw = /.*/ logSource IN ["Okta"] parsed = true`). Programmatic parity for LegacyEventService.LegacySearchRawLogsV2. `resultLimit` values above 10,000 are coerced to 10,000. |