> For the complete documentation index, see [llms.txt](https://docs.truedat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.truedat.io/v8.8/api-integrations/link-manager-apis/search.md).

# Search

## Get filter values

> Retrieve possible filter values for search facets.

```json
{"openapi":"3.0.0","info":{"title":"td-lm","version":"Truedat 8.8.0"},"paths":{"/api/relations/filters":{"post":{"description":"Retrieve possible filter values for search facets.","operationId":"TdLmWeb.SearchController.filters","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersRequest"}}},"description":"Filter request","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get filter values","tags":["Search"]}}},"components":{"schemas":{"FiltersRequest":{"additionalProperties":true,"description":"Optional filters to apply when retrieving filter values. Currently unused but reserved for future extensions.","properties":{"domain_ids":{"description":"Filter by domain IDs","items":{"type":"integer"},"type":"array"},"resource_type":{"description":"Filter by resource type (e.g., 'business_concept')","type":"string"},"status":{"description":"Filter by status values","items":{"type":"string"},"type":"array"}},"title":"FiltersRequest","type":"object"},"FiltersResponse":{"additionalProperties":false,"properties":{"data":{"additionalProperties":{"$ref":"#/components/schemas/FilterValue"},"description":"Filter keys with their possible values","type":"object"}},"required":["data"],"title":"FiltersResponse","type":"object"},"FilterValue":{"additionalProperties":true,"properties":{"values":{"description":"List of possible values for this filter","items":{"type":"string"},"type":"array"}},"required":["values"],"title":"FilterValue","type":"object"},"TdLmUnauthorizedResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmUnauthorizedResponse","type":"object"},"TdLmInternalServerErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmInternalServerErrorResponse","type":"object"}}}}
```

## Search relations

> Search for relations with filters, pagination, sorting and scrolling.

```json
{"openapi":"3.0.0","info":{"title":"td-lm","version":"Truedat 8.8.0"},"paths":{"/api/relations/index_search":{"post":{"description":"Search for relations with filters, pagination, sorting and scrolling.","operationId":"TdLmWeb.SearchController.create","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}},"description":"Search parameters","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}},"description":"OK","headers":{}},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmUnauthorizedResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Search relations","tags":["Search"]}}},"components":{"schemas":{"SearchRequest":{"additionalProperties":false,"description":"Search parameters for relations","properties":{"filters":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"description":"Filters to apply (e.g., status, etc.)","type":"object"},"from":{"description":"Starting offset for pagination","minimum":0,"type":"integer"},"linkable":{"description":"If true, filters results to those linkable by the user","type":"boolean"},"must":{"additionalProperties":true,"description":"Mandatory filters (e.g., source_type, target_type)","properties":{"source_type":{"description":"Source resource type","type":"string"},"target_type":{"description":"Target resource type","type":"string"}},"type":"object"},"query":{"description":"Search query string","type":"string"},"scroll":{"description":"Scroll time (e.g., '1m') to enable scrolling","type":"string"},"scroll_id":{"description":"Scroll ID for retrieving next page (when scrolling)","type":"string"},"size":{"description":"Number of results per page","maximum":100,"minimum":1,"type":"integer"},"sort":{"additionalProperties":{"enum":["asc","desc"],"type":"string"},"description":"Sorting criteria (field: order)","type":"object"}},"title":"SearchRequest","type":"object"},"SearchResponse":{"additionalProperties":false,"properties":{"data":{"description":"List of matching relations","items":{"$ref":"#/components/schemas/RelationSearchResult"},"type":"array"},"scroll_id":{"description":"Scroll ID for retrieving next page (if scroll requested)","nullable":true,"type":"string"}},"required":["data"],"title":"SearchResponse","type":"object"},"RelationSearchResult":{"additionalProperties":true,"description":"A relation as returned by search, including additional fields","properties":{"deleted":{"description":"Soft deletion flag","nullable":true,"type":"boolean"},"deleted_at":{"description":"Deletion timestamp","format":"date-time","nullable":true,"type":"string"},"disabled":{"description":"Disabled flag","nullable":true,"type":"boolean"},"disabled_at":{"description":"Disabled timestamp","format":"date-time","nullable":true,"type":"string"},"disabled_reason":{"description":"Reason for disabling","nullable":true,"type":"string"},"domain_ids":{"description":"All domain IDs involved in the relation","items":{"type":"integer"},"type":"array"},"id":{"description":"Relation ID","type":"integer"},"inserted_at":{"description":"Creation timestamp","format":"date-time","nullable":true,"type":"string"},"ngram_source_name":{"description":"Ngram field for source name","nullable":true,"type":"string"},"ngram_source_name_es":{"description":"Ngram field for source name (Spanish)","nullable":true,"type":"string"},"ngram_target_name":{"description":"Ngram field for target name","nullable":true,"type":"string"},"ngram_target_name_es":{"description":"Ngram field for target name (Spanish)","nullable":true,"type":"string"},"origin":{"description":"Origin of the relation (e.g., 'suggested')","nullable":true,"type":"string"},"source_data":{"additionalProperties":true,"description":"Full source resource data","nullable":true,"type":"object"},"source_domain_ids":{"description":"Domain IDs of the source resource","items":{"type":"integer"},"type":"array"},"source_id":{"description":"Source resource ID","type":"integer"},"source_name":{"description":"Name of the source resource","type":"string"},"source_name_es":{"description":"Source name in Spanish","nullable":true,"type":"string"},"source_type":{"description":"Type of the source resource","type":"string"},"status":{"description":"Status of the relation (pending, approved, rejected)","nullable":true,"type":"string"},"tag_type":{"description":"Tag type derived from tag","nullable":true,"type":"string"},"target_data":{"additionalProperties":true,"description":"Full target resource data","nullable":true,"type":"object"},"target_domain_ids":{"description":"Domain IDs of the target resource","items":{"type":"integer"},"type":"array"},"target_id":{"description":"Target resource ID","type":"integer"},"target_name":{"description":"Name of the target resource","type":"string"},"target_name_es":{"description":"Target name in Spanish","nullable":true,"type":"string"},"target_type":{"description":"Type of the target resource","type":"string"},"updated_at":{"description":"Last update timestamp","format":"date-time","type":"string"}},"required":["id","domain_ids","source_domain_ids","source_id","source_name","source_type","target_domain_ids","target_id","target_name","target_type","updated_at"],"title":"RelationSearchResult","type":"object"},"TdLmUnauthorizedResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmUnauthorizedResponse","type":"object"},"TdLmInternalServerErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmInternalServerErrorResponse","type":"object"}}}}
```

## Reindex all relations

> Triggers a full reindexing of all relations in Elasticsearch.

```json
{"openapi":"3.0.0","info":{"title":"td-lm","version":"Truedat 8.8.0"},"paths":{"/api/relations/index_search/reindex_all":{"get":{"description":"Triggers a full reindexing of all relations in Elasticsearch.","operationId":"TdLmWeb.SearchController.reindex_all","parameters":[],"responses":{"202":{"description":"Reindexing accepted"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmUnauthorizedResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmForbiddenResponse"}}},"description":"Forbidden"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TdLmInternalServerErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Reindex all relations","tags":["Search"]}}},"components":{"schemas":{"TdLmUnauthorizedResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmUnauthorizedResponse","type":"object"},"TdLmForbiddenResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmForbiddenResponse","type":"object"},"TdLmInternalServerErrorResponse":{"properties":{"errors":{"properties":{"detail":{"type":"string"}},"type":"object"}},"title":"TdLmInternalServerErrorResponse","type":"object"}}}}
```
