## MedplumClient.search() method

Sends a FHIR search request.

**Signature:**

```typescript
search<RT extends ResourceType>(resourceType: RT, query?: QueryTypes, options?: MedplumRequestOptions): ReadablePromise<Bundle<WithId<ExtractResource<RT>>>>;
```

## Parameters

| Parameter      | Type                                             | Description                                                                                                                                               |
|----------------|--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| resourceType   | RT                                               | The FHIR resource type.                                                                                                                                 |
| query          | [QueryTypes](/content/docs/sdk/core.querytypes) | _(Optional)_ Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.                        |
| options        | [MedplumRequestOptions](/content/docs/sdk/core.medplumrequestoptions) | _(Optional)_ Optional fetch options.                                                                                                                    |

**Returns:**

[ReadablePromise](/content/docs/sdk/core.readablepromise) <Bundle< [WithId](/content/docs/sdk/core.withid) <ExtractResource<RT>>>>

Promise to the search result bundle.

## Example 1

Example using a FHIR search string:

```typescript
const bundle = await client.search('Patient', 'name=Alice');

console.log(bundle);
```

## Example 2

The return value is a FHIR bundle:

```json
{
   "resourceType": "Bundle",
   "type": "searchset",
   "entry": [
      {
         "resource": {
            "resourceType": "Patient",
            "name": [
               {
                  "given": [
                     "George"
                  ],
                  "family": "Washington"
               }
            ],
         }
      }
   ]
}
```

## Example 3

To query the count of a search, use the summary feature like so:

```typescript
const patients = medplum.search('Patient', '_summary=count');
```

See [FHIR search](https://www.hl7.org/fhir/search.html) for full details.
