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

# Search Entities

> Full-text search across all entity types in the metadata catalog

# Search Entities

Full-text search across all entity types in the metadata catalog. Uses Elasticsearch query syntax under the hood.

## Query Parameters

**q** `string` *required*

Search query string. Supports Elasticsearch query syntax including wildcards, boolean operators, and phrase matching.

**index** `string` (default: all)

Search index to query. Options: `all`, `table_search_index`, `topic_search_index`, `dashboard_search_index`, `pipeline_search_index`, `mlmodel_search_index`, `container_search_index`, `search_entity_search_index`, `glossary_term_search_index`, `tag_search_index`, `user_search_index`, `team_search_index`, `domain_search_index`, `data_product_search_index`.

**from** `integer` (default: 0)

Starting offset for pagination. Must be 0 or greater. A negative value returns `400`.

**size** `integer` (default: 10)

Number of results to return. Must be 0 or greater. A negative value returns `400`.

**deleted** `boolean` (default: false)

Include soft-deleted entities in the results.

**sortField** `string`

Field to sort by, for example `name`, `updatedAt`, `totalVotes`.

**sortOrder** `string`

Sort order: `asc` or `desc`.

**trackTotalHits** `boolean` (default: true)

Track exact total hit count. Set to `false` for faster queries when exact count is not needed.

**getHierarchy** `boolean` (default: false)

Include entity hierarchy in results.

**fetchSource** `boolean` (default: true)

Include the full source document in results. Set to `false` to return only metadata.

**includeSourceFields** `string`

Comma-separated list of source fields to include. Use this to limit the response payload.

**query\_filter** `string`

JSON query filter using Elasticsearch DSL. Applied before scoring.

**postFilter** `string`

JSON post-filter using Elasticsearch DSL. Applied after scoring without affecting aggregations.

```python GET /v1/search/query theme={null}
from urllib.parse import urlencode

from metadata.sdk import client, configure

configure(
    host="https://your-company.open-metadata.org/api",
    jwt_token="your-jwt-token"
)
rest = client().ometa.client

# Search for tables matching "customer"
params = urlencode({
    "q": "customer",
    "index": "table_search_index",
    "from": 0,
    "size": 10
})
response = rest.get(f"/search/query?{params}")

for hit in response["hits"]["hits"]:
    entity = hit["_source"]
    print(f"{entity['entityType']}: {entity['fullyQualifiedName']} (score: {hit['_score']})")
```

```java GET /v1/search/query theme={null}
// client is an initialized OpenMetadataClient.
// Search using the OpenMetadata client
var response = client.searchApi().searchEntities(
    "customer",           // query
    "table_search_index", // index
    0,                    // from
    10                    // size
);

for (var hit : response.getHits().getHits()) {
    var source = hit.getSource();
    System.out.println(source.getEntityType() + ": " + source.getFullyQualifiedName());
}
```

```bash GET /v1/search/query theme={null}
# Basic search across all entities
curl "{base_url}/api/v1/search/query?q=dim&from=0&size=10" \
  -H "Authorization: Bearer {access_token}"

# Search within a specific index
curl "{base_url}/api/v1/search/query?q=customer&index=table_search_index&size=5" \
  -H "Authorization: Bearer {access_token}"

# Search with sorting
curl "{base_url}/api/v1/search/query?q=*&index=table_search_index&sortField=name&sortOrder=asc&size=20" \
  -H "Authorization: Bearer {access_token}"

# Search with query filter (Elasticsearch DSL)
curl -G "{base_url}/api/v1/search/query" \
  --data-urlencode "q=*" \
  --data-urlencode "index=table_search_index" \
  --data-urlencode 'query_filter={"query":{"bool":{"must":[{"term":{"serviceType":"BigQuery"}}]}}}' \
  -H "Authorization: Bearer {access_token}"
```

```json Response theme={null}
{
  "took": 8,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0,
    "skipped": 0
  },
  "hits": {
    "total": {
      "value": 53,
      "relation": "eq"
    },
    "hits": [
      {
        "_index": "table_search_index",
        "_id": "455e3d9d-dbbf-455e-b3be-7191daa825f3",
        "_score": 2.3,
        "_source": {
          "id": "455e3d9d-dbbf-455e-b3be-7191daa825f3",
          "name": "dim_address",
          "fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_address",
          "entityType": "table",
          "serviceType": "BigQuery",
          "description": "Address dimension table",
          "owners": [],
          "tags": [],
          "columns": [
            {
              "name": "address_id",
              "dataType": "NUMERIC",
              "fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_address.address_id"
            }
          ]
        }
      }
    ]
  }
}
```

***

## Returns

Returns an Elasticsearch-style response containing matched entities ranked by relevance score.

## Response

**took** `integer`

Time in milliseconds the search took to execute.

**timed\_out** `boolean`

Whether the search timed out.

**hits** `object`

Search results container.

**properties**

**total** `object`

Total hit count information.

**properties**

**value** `integer`

Total number of matching entities.

**relation** `string`

Relation to the actual count. `eq` means exact, `gte` means the count is a lower bound.

**hits** `array`

Array of matching entity results.

**properties**

**\_index** `string`

Search index the result was found in, for example `table_search_index`.

**\_id** `string`

Unique identifier of the entity (UUID format).

**\_score** `number`

Relevance score for the match. Higher scores indicate better matches.

**\_source** `object`

The full entity object. Contents vary by entity type but always include `id`, `name`, `fullyQualifiedName`, and `entityType`.

***

## Aggregations

`GET /v1/search/aggregate` and `POST /v1/search/aggregate` apply the caller's access rules to the query, in the same way as search. The aggregations cover only the assets that the caller is allowed to view.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `400` | `BAD_REQUEST` | Invalid query syntax or parameters, a negative `from` or `size`, or an unknown search index (`Unknown search index [name]`) |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to search entities |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.