class_docstr: A component for writing documents to a DocumentStore.
docstr: Run DocumentWriter on the given input data.
  
  :param documents: A list of documents to write to the store.
  :param policy: The policy to use when encountering duplicate documents.
  :return: Number of documents written
  
  :raises ValueError: If the specified document store is not found.
docstr_tok: ["Run","DocumentWriter","on","the","given","input","data",".",":","param","documents",":","A","list","of","documents","to","write","to","the","store",".",":","param","policy",":","The","policy","to","use","when","encountering","duplicate","documents",".",":","return",":","Number","of","documents","written",":","raises","ValueError",":","If","the","specified","document","store","is","not","found","."]
code: def run(
      self,
      documents: List[Document],
      policy: Optional[DuplicatePolicy] = None,
  ):
      """
      Run DocumentWriter on the given input data.
  
      :param documents: A list of documents to write to the store.
      :param policy: The policy to use when encountering duplicate documents.
      :return: Number of documents written
  
      :raises ValueError: If the specified document store is not found.
      """
      if policy is None:
          policy = self.policy
  
      documents_written = self.document_store.write_documents(
          documents=documents, policy=policy
      )
      return {"documents_written": documents_written}
  
file_path: haystack/haystack/components/writers/document_writer.py
imports: from typing import List, Optional, Dict, Any
  import importlib
  import logging
  from haystack import component, Document, default_from_dict, default_to_dict, DeserializationError
  from haystack.document_stores.types import DocumentStore, DuplicatePolicy
label_desc: Use image node_id 5 for calling the DocumentWriter obj's underlying member method code with example usage: obj.run(documents, policy) and returns: dict