> ## 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.

# Bulk index entities

> Add or update one or more entities in the global search index. Each item is validated then published to the internal event stream — embedding generation and indexing happen asynchronously. Returns 202 with the count of accepted operations.

**Required fields**: ``organization_id``, ``project_id``, ``entity_type``, ``entity_id``, ``title``, ``permission_id``.

**``embedded_text``**: The text used for BM25 indexing and embedding generation. For catalog entities this should be an LLM-generated contextual summary (~1000 tokens). For other entities use title + description concatenation. The embedding vector is generated asynchronously by the search handler — publishing services do not need to compute it.

**``search_attributes``**: Flat ``dict[str, str]`` of fields that support structured query syntax on ``POST /search/global``. All values must be strings. Standard keys for catalog entities:
``name`` — entity name
``service_name`` — data source name (supports ``service.name:X``)
``database_name`` — database name (supports ``database.name:X``)
``schema_name`` — schema name (supports ``databaseSchema.name:X``)
``tags`` — space-separated tag FQNs (supports ``tags.tagFQN:PII*``)
``is_pii_tagged`` — 'true'/'false' (supports ``extension.is_pii_tagged:1``)
``is_sensitivity_tagged`` — 'true'/'false'
``has_description`` — 'true'/'false' (supports ``NOT _exists_:description``)
``has_owners`` — 'true'/'false' (supports ``NOT _exists_:owners``)
``has_undescribed_columns`` — 'true'/'false' (supports ``NOT _exists_:columns.description``)
``columns_tags_tagFQN`` — space-separated column tag FQNs (supports ``_exists_:columns.tags.tagFQN:PII*``)



## OpenAPI

````yaml /openapi/em-runtime-search-v2.yaml post /search/bulk/index
openapi: 3.1.0
info:
  title: em_runtime_search
  version: 5.27.0
servers: []
security: []
paths:
  /search/bulk/index:
    post:
      tags:
        - search
      summary: Bulk index entities
      description: >-
        Add or update one or more entities in the global search index. Each item
        is validated then published to the internal event stream — embedding
        generation and indexing happen asynchronously. Returns 202 with the
        count of accepted operations.


        **Required fields**: ``organization_id``, ``project_id``,
        ``entity_type``, ``entity_id``, ``title``, ``permission_id``.


        **``embedded_text``**: The text used for BM25 indexing and embedding
        generation. For catalog entities this should be an LLM-generated
        contextual summary (~1000 tokens). For other entities use title +
        description concatenation. The embedding vector is generated
        asynchronously by the search handler — publishing services do not need
        to compute it.


        **``search_attributes``**: Flat ``dict[str, str]`` of fields that
        support structured query syntax on ``POST /search/global``. All values
        must be strings. Standard keys for catalog entities:

        ``name`` — entity name

        ``service_name`` — data source name (supports ``service.name:X``)

        ``database_name`` — database name (supports ``database.name:X``)

        ``schema_name`` — schema name (supports ``databaseSchema.name:X``)

        ``tags`` — space-separated tag FQNs (supports ``tags.tagFQN:PII*``)

        ``is_pii_tagged`` — 'true'/'false' (supports
        ``extension.is_pii_tagged:1``)

        ``is_sensitivity_tagged`` — 'true'/'false'

        ``has_description`` — 'true'/'false' (supports ``NOT
        _exists_:description``)

        ``has_owners`` — 'true'/'false' (supports ``NOT _exists_:owners``)

        ``has_undescribed_columns`` — 'true'/'false' (supports ``NOT
        _exists_:columns.description``)

        ``columns_tags_tagFQN`` — space-separated column tag FQNs (supports
        ``_exists_:columns.tags.tagFQN:PII*``)
      operationId: bulk_index_entities
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/SearchIndexRequest'
              type: array
              title: Body
        required: true
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkIndexResponse'
        '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:
    SearchIndexRequest:
      properties:
        organization_id:
          type: string
          title: Organization Id
          description: Organisation the entity belongs to
        project_id:
          type: string
          title: Project Id
          description: Project the entity belongs to
        entity_type:
          type: string
          title: Entity Type
          description: Entity type (e.g. 'table', 'agent', 'project', 'artifact')
          examples:
            - table
            - agent
            - project
        entity_id:
          type: string
          title: Entity Id
          description: Stable unique identifier for the entity within its domain service
          examples:
            - mydb.analytics.public.users
            - agent-abc123
        title:
          type: string
          title: Title
          description: Primary display label shown in search results
        subtitle:
          anyOf:
            - type: string
            - type: 'null'
          title: Subtitle
          description: Secondary label (e.g. schema.database, asset subtype)
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: Deep-link to the entity's detail page
        embedded_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Embedded Text
          description: >-
            Text to BM25-index and embed. For catalog entities: LLM-generated
            contextual summary. For others: title + description concatenation.
            The search handler generates the embedding vector from this field
            automatically.
        permission_id:
          type: string
          title: Permission Id
          description: >-
            OpenFGA object ID used as the permission boundary for this entity.
            Must match the object ID registered in OpenFGA for this resource.
            Examples: 'data:org:proj:mypostgres' for catalog entities, project
            UUID for projects.
        rank_boost:
          type: number
          maximum: 10
          minimum: 0.1
          title: Rank Boost
          description: >-
            Per-entity weighting applied after RRF fusion. Default 1.0. Higher =
            more prominent.
          default: 1
        search_attributes:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Search Attributes
          description: >-
            Service-defined fields for BM25 keyword search beyond embedded_text.
            Supports both flat keys and nested objects — use whichever matches
            your domain naturally. Flat: {'status': 'active', 'owner':
            'data-team'}. Nested (OpenMetadata-style): {'service': {'name':
            'mysql'}, 'tags': [{'tagFQN': 'PII.Sensitive'}]}. Queried via dot
            notation: 'service.name:mysql' or 'tags.tagFQN:PII*'.
        extra_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Extra Metadata
          description: >-
            Lightweight structured data for display and equality filtering. Not
            BM25-indexed. Keep under 2KB. Example: {'fqn': 'mydb.public.users',
            'is_pii_tagged': True}
      type: object
      required:
        - organization_id
        - project_id
        - entity_type
        - entity_id
        - title
        - permission_id
      title: SearchIndexRequest
      description: >-
        Request body for POST /search/index.


        Publishing services call this endpoint to add or update an entity in the

        global search index. The endpoint validates the payload and publishes it

        to the Redis Stream — the handler generates the embedding
        asynchronously.


        Required fields:
            organization_id, project_id, entity_type, entity_id, title, permission_id

        Optional fields:
            subtitle, url, embedded_text, rank_boost, search_attributes, extra_metadata
    BulkIndexResponse:
      properties:
        accepted:
          type: integer
          title: Accepted
          description: Number of operations accepted and queued for processing
      type: object
      required:
        - accepted
      title: BulkIndexResponse
      description: Response from POST /search/bulk/index and POST /search/bulk/delete.
    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
    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

````