Skip to main content

DocumentWriter

Writes documents to a DocumentStore.

Basic Information

  • Type: haystack_integrations.writers.document_writer.DocumentWriter

Inputs

ParameterTypeDefaultDescription
documentsList[Document]A list of documents to write to the document store.
policyOptional[DuplicatePolicy]NoneThe policy to use when encountering duplicate documents.

Outputs

ParameterTypeDefaultDescription
documents_writtenintNumber of documents written to the document store.

Overview

Work in Progress

Bear with us while we're working on adding pipeline examples and most common components connections.

Writes documents to a DocumentStore.

Usage Example

components:
DocumentWriter:
type: components.writers.document_writer.DocumentWriter
init_parameters:

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
document_storeDocumentStoreThe instance of the document store where you want to store your documents.
policyDuplicatePolicyDuplicatePolicy.NONEThe policy to apply when a Document with the same ID already exists in the DocumentStore. - DuplicatePolicy.NONE: Default policy, relies on the DocumentStore settings. - DuplicatePolicy.SKIP: Skips documents with the same ID and doesn't write them to the DocumentStore. - DuplicatePolicy.OVERWRITE: Overwrites documents with the same ID. - DuplicatePolicy.FAIL: Raises an error if a Document with the same ID is already in the DocumentStore.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
documentsList[Document]A list of documents to write to the document store.
policyOptional[DuplicatePolicy]NoneThe policy to use when encountering duplicate documents.