MATIH Platform is in active MVP development. Documentation reflects current implementation status.
10. Data Catalog & Governance
Search & Autocomplete

Search & Autocomplete

The Catalog Service provides full-text search across all catalog entities using Elasticsearch, along with autocomplete suggestions for a responsive user experience.


Search Architecture

The CatalogSearchService integrates with Elasticsearch to index and search across databases, tables, columns, tags, and descriptions. All searches are tenant-scoped.

User Query --> CatalogController --> CatalogSearchService --> Elasticsearch
                                                                  |
                                                            Index per tenant
                                                            (catalog_{tenantId})

Full-Text Search

Endpoint

POST /api/v1/catalog/search

Request Body

{
  "query": "customer orders",
  "entityTypes": ["TABLE", "DATABASE"],
  "tags": ["pii", "production"],
  "page": 0,
  "size": 20
}

Example

curl -X POST http://localhost:8086/api/v1/catalog/search \
  -H "Content-Type: application/json" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "query": "customer orders",
    "page": 0,
    "size": 20
  }'

Response

{
  "content": [
    {
      "entityType": "TABLE",
      "entityId": "a1b2c3d4-...",
      "name": "customer_orders",
      "fullyQualifiedName": "warehouse.public.customer_orders",
      "description": "All customer order transactions",
      "tags": ["production", "pii"],
      "score": 9.82
    }
  ],
  "totalElements": 42,
  "totalPages": 3,
  "number": 0,
  "size": 20
}

Autocomplete Suggestions

The suggest endpoint provides prefix-based autocomplete for search-as-you-type interfaces.

Endpoint

GET /api/v1/catalog/suggest?prefix={prefix}&limit={limit}

Example

curl "http://localhost:8086/api/v1/catalog/suggest?prefix=cust&limit=10" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"

Response

[
  "customer_orders",
  "customer_profiles",
  "customer_segments",
  "customer_addresses",
  "custom_metrics"
]

Search Tracking

The Discovery Controller tracks search terms for popularity analytics:

POST /api/v1/catalog/discovery/search-track
{
  "searchTerm": "customer orders"
}

Popular searches can then be retrieved:

curl "http://localhost:8086/api/v1/catalog/discovery/popular-searches?limit=10" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"
[
  { "term": "customer orders", "searchCount": 47 },
  { "term": "revenue metrics", "searchCount": 32 },
  { "term": "user sessions", "searchCount": 28 }
]

Source Reference

ComponentFile
Search endpointCatalogController.java -- search(), suggest()
Search serviceCatalogSearchService.java
Search request modelSearchRequest.java
Search result modelSearchResult.java
Search trackingCatalogDiscoveryController.java -- recordSearch()
Elasticsearch configElasticsearchConfig.java