updateEntity()
updateEntity(
request:UpdateEntityRequest):Promise<EntityOperationResponse>
Defined in: packages/core/src/document-search/index.ts:646
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
| Parameter | Type | Description |
|---|---|---|
request | UpdateEntityRequest | Entity update request |
Returns
Promise<EntityOperationResponse>
Promise resolving to EntityOperationResponse:
success- Whether the operation succeededaffectedChunks- Number of chunks updatedmessage- Success or error message
Throws
401 - Not authenticated
Throws
404 - Entity not found
Throws
422 - Validation error
Example
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"],
});