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

# Global search

> Unified search across all entity types — projects, assets, data connections, catalog entities (databases, schemas, tables, columns), files, artifacts, agents, and models. Results are filtered to entities the authenticated user can access.

**Query modes** (set via the ``mode`` field):

- ``semantic`` *(default)*: Plain natural language. ``q`` is run through BM25 and, when an embedding service is configured, also vectorised for hybrid RRF ranking. Best for conversational queries.

- ``structured``: Elasticsearch-style query string in ``query``. Parsed by the Lark grammar and translated to SQL predicates against the ``search_attributes`` JSONB column and the ParadeDB BM25 index. Supports field:value, wildcards, boolean AND/OR/NOT, _exists_ checks, tag filtering, and extension field comparisons. Replaces the retired ``GET /search/metadata`` endpoint.

- ``hybrid``: Both legs simultaneously. ``q`` drives semantic ranking; ``query`` applies structural constraints. Results are merged via Reciprocal Rank Fusion (RRF).

**Pagination**: pass ``session_id`` from the first response on subsequent pages to reuse the scope session and avoid re-running the OpenFGA ListObjects fan-out.

**Structured query syntax examples**:
``service.name:mysql AND tags.tagFQN:PII*`` — PII-tagged tables in a MySQL service
``NOT _exists_:owners AND entity_type:table`` — tables missing owners
``NOT _exists_:columns.description`` — tables with undescribed columns
``extension.is_pii_tagged:1 AND databaseSchema.name:public`` — PII tables in public schema
``(tags.tagFQN:SENSITIVITY_TAGS.Confidential OR tags.tagFQN:SENSITIVITY_TAGS.Restricted) AND service.name:snowflake`` — confidential or restricted Snowflake entities



## OpenAPI

````yaml /openapi/em-runtime-search-v2.yaml post /search/global
openapi: 3.1.0
info:
  title: em_runtime_search
  version: 5.27.0
servers: []
security: []
paths:
  /search/global:
    post:
      tags:
        - search
      summary: Global search
      description: >-
        Unified search across all entity types — projects, assets, data
        connections, catalog entities (databases, schemas, tables, columns),
        files, artifacts, agents, and models. Results are filtered to entities
        the authenticated user can access.


        **Query modes** (set via the ``mode`` field):


        - ``semantic`` *(default)*: Plain natural language. ``q`` is run through
        BM25 and, when an embedding service is configured, also vectorised for
        hybrid RRF ranking. Best for conversational queries.


        - ``structured``: Elasticsearch-style query string in ``query``. Parsed
        by the Lark grammar and translated to SQL predicates against the
        ``search_attributes`` JSONB column and the ParadeDB BM25 index. Supports
        field:value, wildcards, boolean AND/OR/NOT, _exists_ checks, tag
        filtering, and extension field comparisons. Replaces the retired ``GET
        /search/metadata`` endpoint.


        - ``hybrid``: Both legs simultaneously. ``q`` drives semantic ranking;
        ``query`` applies structural constraints. Results are merged via
        Reciprocal Rank Fusion (RRF).


        **Pagination**: pass ``session_id`` from the first response on
        subsequent pages to reuse the scope session and avoid re-running the
        OpenFGA ListObjects fan-out.


        **Structured query syntax examples**:

        ``service.name:mysql AND tags.tagFQN:PII*`` — PII-tagged tables in a
        MySQL service

        ``NOT _exists_:owners AND entity_type:table`` — tables missing owners

        ``NOT _exists_:columns.description`` — tables with undescribed columns

        ``extension.is_pii_tagged:1 AND databaseSchema.name:public`` — PII
        tables in public schema

        ``(tags.tagFQN:SENSITIVITY_TAGS.Confidential OR
        tags.tagFQN:SENSITIVITY_TAGS.Restricted) AND service.name:snowflake`` —
        confidential or restricted Snowflake entities
      operationId: global_search
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '401':
          description: Not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    SearchRequest:
      properties:
        q:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Q
          description: >-
            Natural language search query. Passed to the BM25 index and (when an
            embedding service is configured) vectorised for the vector leg of
            RRF. Example: 'tables containing customer revenue data'
        query:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Query
          description: >-
            Elasticsearch-style query string. Parsed by the Lark grammar and
            translated to SQL predicates against search_attributes JSONB and the
            ParadeDB BM25 index. Example: 'service.name:mysql AND
            tags.tagFQN:PII* AND NOT _exists_:owners'
        sort_by:
          $ref: '#/components/schemas/SearchSortBy'
          description: >-
            Result ordering. RELEVANCE (default): ranked by BM25/RRF score.
            NAME: alphabetical by title. CREATED_AT: by creation time. RELEVANCE
            is ignored for STRUCTURED mode with no bare-word terms.
          default: relevance
        sort_order:
          $ref: '#/components/schemas/SearchSortOrder'
          description: >-
            Sort direction for NAME and CREATED_AT. ASC (default) or DESC. Has
            no effect when sort_by=RELEVANCE — relevance scores are always
            ranked highest-first.
          default: asc
        limit:
          type: integer
          maximum: 100
          minimum: 1
          title: Limit
          description: Page size (1–100, default 20)
          default: 20
        offset:
          type: integer
          minimum: 0
          title: Offset
          description: Pagination offset (default 0)
          default: 0
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
          description: >-
            Permission session token from a previous response. Pass this on
            subsequent paginated requests to reuse the scope materialisation and
            avoid re-running the OpenFGA ListObjects fan-out on every page.
      type: object
      title: SearchRequest
      description: >-
        Request body for POST /search/global.


        The execution mode is inferred automatically from the fields provided:


        **Semantic** — provide ``q`` only. Natural language, BM25 + optional
        vector RRF::

            {"q": "tables with customer revenue data"}

        **Structured** — provide ``query`` only. Elasticsearch-style
        predicates::

            {"query": "service.name:mysql AND tags.tagFQN:PII*"}

        **Hybrid** — provide both. ``q`` drives BM25/vector; ``query`` applies
        hard constraints::

            {"q": "customer revenue", "query": "service.name:snowflake AND NOT _exists_:owners"}

        Structured query syntax

        -----------------------

        +-----------------------------------------+----------------------------------------------+

        | Expression                              |
        Meaning                                      |

        +=========================================+==============================================+

        | ``users``                               | BM25 full-text match on
        embedded_text        |

        +-----------------------------------------+----------------------------------------------+

        | ``name:users``                          | Exact name
        match                             |

        +-----------------------------------------+----------------------------------------------+

        | ``name:user*``                          | Trailing-wildcard name
        match                 |

        +-----------------------------------------+----------------------------------------------+

        | ``service.name:"mysql"``                | Filter by data source
        name                   |

        +-----------------------------------------+----------------------------------------------+

        | ``database.name:"prod"``                | Filter by database
        name                      |

        +-----------------------------------------+----------------------------------------------+

        | ``databaseSchema.name:"public"``        | Filter by schema
        name                        |

        +-----------------------------------------+----------------------------------------------+

        | ``tags.tagFQN:PII*``                    | Tag FQN prefix
        match                         |

        +-----------------------------------------+----------------------------------------------+

        | ``tags.tagFQN:SENSITIVITY_TAGS.Conf*``  | Exact tag FQN
        prefix                         |

        +-----------------------------------------+----------------------------------------------+

        | ``extension.is_pii_tagged:1``           | Boolean extension field
        (1/true/0/false)     |

        +-----------------------------------------+----------------------------------------------+

        | ``extension.is_sensitivity_tagged:0``   | Entities not
        sensitivity-tagged              |

        +-----------------------------------------+----------------------------------------------+

        | ``_exists_:description``                | Has a
        description                            |

        +-----------------------------------------+----------------------------------------------+

        | ``NOT _exists_:description``            | Missing
        description                          |

        +-----------------------------------------+----------------------------------------------+

        | ``NOT _exists_:owners``                 | Missing
        owners                               |

        +-----------------------------------------+----------------------------------------------+

        | ``NOT _exists_:columns.description``    | Has columns missing
        descriptions             |

        +-----------------------------------------+----------------------------------------------+

        | ``_exists_:columns.tags.tagFQN:PII*``   | Has PII-tagged
        columns                       |

        +-----------------------------------------+----------------------------------------------+

        | ``entity_type:table``                    | Restrict to a specific
        entity type           |

        +-----------------------------------------+----------------------------------------------+

        | ``entity_id:snowflake-prod.analytics.*`` | FQN prefix scope (all
        children)              |

        +-----------------------------------------+----------------------------------------------+

        | ``A AND B``, ``A OR B``, ``NOT A``      | Boolean
        operators                            |

        +-----------------------------------------+----------------------------------------------+

        | ``(A OR B) AND C``                      |
        Grouping                                     |

        +-----------------------------------------+----------------------------------------------+
    SearchResponse:
      properties:
        session_id:
          type: string
          title: Session Id
          description: >-
            Pass this on subsequent paginated requests to reuse the scope
            session and avoid re-running the OpenFGA ListObjects fan-out.
            Sessions expire after 30 minutes of inactivity.
        pagination:
          $ref: '#/components/schemas/SearchPagination'
        results:
          items:
            $ref: '#/components/schemas/SearchResult'
          type: array
          title: Results
      type: object
      required:
        - session_id
        - pagination
        - results
      title: SearchResponse
      description: Response body for POST /search/global.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
      description: Standard error response model.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchSortBy:
      type: string
      enum:
        - relevance
        - name
        - created_at
      title: SearchSortBy
    SearchSortOrder:
      type: string
      enum:
        - asc
        - desc
      title: SearchSortOrder
    SearchPagination:
      properties:
        offset:
          type: integer
          title: Offset
        limit:
          type: integer
          title: Limit
        total:
          type: integer
          title: Total
      type: object
      required:
        - offset
        - limit
        - total
      title: SearchPagination
    SearchResult:
      properties:
        entity_type:
          type: string
          title: Entity Type
        entity_id:
          type: string
          title: Entity Id
        title:
          type: string
          title: Title
        subtitle:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtitle
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        score:
          type: number
          title: Score
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
      type: object
      required:
        - entity_type
        - entity_id
        - title
        - score
      title: SearchResult
      description: A single search result.
    ErrorBody:
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          title: Message
        details:
          additionalProperties: true
          type: object
          title: Details
        request_id:
          type: string
          title: Request Id
        timestamp:
          type: string
          format: date-time
          title: Timestamp
      type: object
      required:
        - code
        - message
        - request_id
        - timestamp
      title: ErrorBody
      description: Error body with structured details.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_TOKEN
        - INSUFFICIENT_PERMISSIONS
        - RESOURCE_NOT_FOUND
        - RESOURCE_ALREADY_EXISTS
        - VALIDATION_ERROR
        - RATE_LIMIT_EXCEEDED
        - SERVICE_UNAVAILABLE
        - INTERNAL_ERROR
      title: ErrorCode
      description: Standard error codes for API responses.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````