The upsertDocuments method adds or updates multiple documents in the catalog in a single operation. It supports various types of documents, including text, JSON, files, URLs, and sitemaps.
Supported document types
TextDocument: For inline text or markdown content
JSONDocument: For inline JSON content
FileDocument: For file-based content (.docx, .md, .mdx, and .txt)
UrlDocument: For web page content
SitemapDocument: For scraping entire sitemap URLs
Parameters
batch: DocumentBatch - An array of documents to be upserted. All documents in the batch must have the same content type.
Returns
A Promise that resolves when the upsert operation is complete.
TextDocument
Upserting inline markdown:
Upserting inline text:
JSONDocument
JSON objects can be individually uploaded via batch upsert. For bulk JSON ingestion of JSON arrays, use the JSON indexer.
FileDocument
Upload .txt, .md, .mdx or .docx files:
UrlDocument
Upsert one or more URLs for web scraping. Upserting URLs returns immediately with a 202 accepted, and scraping and indexing happens asynchronously.
SitemapDocument
Upsert one or more sitemap documents to scrape and index an entire website. Sitemaps and sitemap indexes will be recursively traversed. Upserting sitemaps returns immediately with a 202 accepted, and scraping and indexing happens asynchronously.