@cpod/sdk - v0.2.7
    Preparing search index...

    Function updateEntity

    • Update/rename an entity across document chunks

      Renames an entity in the document index. The operation can be scoped to specific sources, files, or chunks.

      Parameters

      • request: UpdateEntityRequest

        Entity update request

        Request to update/rename an entity

        • oldName: string

          Current entity name

          1

          255

        • newName: string

          New entity name (must be different from oldName)

          1

          255

        • Optionalsources?: string[]

          Optional: Filter by specific sources

        • OptionalfileHashes?: string[]

          Optional: Filter by specific file hashes

        • OptionalchunkIds?: string[]

          Optional: Filter by specific chunk IDs

      Returns Promise<EntityOperationResponse>

      Promise resolving to EntityOperationResponse:

      • success - Whether the operation succeeded
      • affectedChunks - Number of chunks updated
      • message - Success or error message

      401 - Not authenticated

      404 - Entity not found

      422 - Validation error

      import { updateEntity } from "@cpod/sdk";

      // Rename entity globally
      const result = await updateEntity({
      oldName: "Acme",
      newName: "Acme Corporation",
      });
      console.log(`Updated ${result.affectedChunks} chunks`);

      // Rename only in specific source
      const scopedResult = await updateEntity({
      oldName: "J. Smith",
      newName: "John Smith",
      sources: ["contracts", "hr_documents"],
      });