> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

Searches DataItems in a Dataset.

## Arguments

| Parameters ||
|---|---|
| `dataset` | `string` Required. The resource name of the Dataset from which to search DataItems. Format: `projects/{project}/locations/{location}/datasets/{dataset}` |
| `annotationFilters` | `string` An expression that specifies what Annotations will be returned per DataItem. Annotations satisfied either of the conditions will be returned. \* `annotation_spec_id` - for = or !=. Must specify `saved_query_id=` - saved query id that annotations should belong to. |
| `annotationsFilter` | `string` An expression for filtering the Annotations that will be returned per DataItem. \* `annotation_spec_id` - for = or !=. |
| `annotationsLimit` | `integer (int32 format)` If set, only up to this many of Annotations will be returned per DataItemView. The maximum value is 1000. If not set, the maximum value will be used. |
| `dataItemFilter` | `string` An expression for filtering the DataItem that will be returned. \* `data_item_id` - for = or !=. \* `labeled` - for = or !=. \* `has_annotation(ANNOTATION_SPEC_ID)` - true only for DataItem that have at least one annotation with annotation_spec_id = `ANNOTATION_SPEC_ID` in the context of SavedQuery or DataLabelingJob. For example: \* `data_item=1` \* `has_annotation(5)` |
| `dataLabelingJob` | `string` The resource name of a DataLabelingJob. Format: `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}` If this field is set, all of the search will be done in the context of this DataLabelingJob. |
| `fieldMask` | `string (FieldMask format)` Mask specifying which fields of DataItemView to read. |
| `orderBy` | `string` A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. |
| `orderByAnnotation.orderBy` | `string` A comma-separated list of annotation fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Must also specify saved_query. |
| `orderByAnnotation.savedQuery` | `string` Required. Saved query of the Annotation. Only Annotations belong to this saved query will be considered for ordering. |
| `orderByDataItem` | `string` A comma-separated list of data item fields to order by, sorted in ascending order. Use "desc" after a field name for descending. |
| `pageSize` | `integer (int32 format)` Requested page size. Server may return fewer results than requested. Default and maximum page size is 100. |
| `pageToken` | `string` A token identifying a page of results for the server to return Typically obtained via SearchDataItemsResponse.next_page_token of the previous DatasetService.SearchDataItems call. |
| `savedQuery` | `string` The resource name of a SavedQuery(annotation set in UI). Format: `projects/{project}/locations/{location}/datasets/{dataset}/savedQueries/{saved_query}` All of the search will be done in the context of this SavedQuery. |
| `region` | `string` Required. Region of the HTTP endpoint. For example, if region is set to `us-central1`, the endpoint https://us-central1-integrations.googleapis.com will be used. See [service endpoints](https://cloud.google.com/vertex-ai/docs/reference/rest#rest_endpoints). |

## Raised exceptions

| Exceptions ||
|---|---|
| `ConnectionError` | In case of a network problem (such as DNS failure or refused connection). |
| `HttpError` | If the response status is \>= 400 (excluding 429 and 503). |
| `TimeoutError` | If a long-running operation takes longer to finish than the specified timeout limit. |
| `TypeError` | If an operation or function receives an argument of the wrong type. |
| `ValueError` | If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout. |

## Response

If successful, the response contains an instance of [`GoogleCloudAiplatformV1beta1SearchDataItemsResponse`](https://cloud.google.com/workflows/docs/reference/googleapis/aiplatform/v1beta1/Overview#GoogleCloudAiplatformV1beta1SearchDataItemsResponse).

## Subworkflow snippet

Some fields might be optional or required.
To identify required fields, refer to the [API documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/projects.locations.datasets/searchDataItems).

### YAML

```yaml
- searchDataItems:
    call: googleapis.aiplatform.v1beta1.projects.locations.datasets.searchDataItems
    args:
        dataset: ...
        annotationFilters: ...
        annotationsFilter: ...
        annotationsLimit: ...
        dataItemFilter: ...
        dataLabelingJob: ...
        fieldMask: ...
        orderBy: ...
        orderByAnnotation:
            orderBy: ...
            savedQuery: ...
        orderByDataItem: ...
        pageSize: ...
        pageToken: ...
        savedQuery: ...
        region: ...
    result: searchDataItemsResult
```

### JSON

```json
[
  {
    "searchDataItems": {
      "call": "googleapis.aiplatform.v1beta1.projects.locations.datasets.searchDataItems",
      "args": {
        "dataset": "...",
        "annotationFilters": "...",
        "annotationsFilter": "...",
        "annotationsLimit": "...",
        "dataItemFilter": "...",
        "dataLabelingJob": "...",
        "fieldMask": "...",
        "orderBy": "...",
        "orderByAnnotation": {
          "orderBy": "...",
          "savedQuery": "..."
        },
        "orderByDataItem": "...",
        "pageSize": "...",
        "pageToken": "...",
        "savedQuery": "...",
        "region": "..."
      },
      "result": "searchDataItemsResult"
    }
  }
]
```