class_docstr: Stores Documents to be used by the components of a Pipeline.
  
  Classes implementing this protocol often store the documents permanently and allow specialized components to
  perform retrieval on them, either by embedding, by keyword, hybrid, and so on, depending on the backend used.
  
  In order to retrieve documents, consider using a Retriever that supports the DocumentStore implementation that
  you're using.
docstr: Writes Documents into the DocumentStore.
  
  :param documents: a list of Document objects.
  :param policy: the policy to apply when a Document with the same id already exists in the DocumentStore.
      - `DuplicatePolicy.NONE`: Default policy, behaviour depends on the Document Store.
      - `DuplicatePolicy.SKIP`: If a Document with the same id already exists, it is skipped and not written.
      - `DuplicatePolicy.OVERWRITE`: If a Document with the same id already exists, it is overwritten.
      - `DuplicatePolicy.FAIL`: If a Document with the same id already exists, an error is raised.
  :raises DuplicateError: If `policy` is set to `DuplicatePolicy.FAIL` and a Document with the same id already exists.
  :return: The number of Documents written.
      If `DuplicatePolicy.OVERWRITE` is used, this number is always equal to the number of documents in input.
      If `DuplicatePolicy.SKIP` is used, this number can be lower than the number of documents in the input list.
code: def write_documents(
      self,
      documents: List[Document],
      policy: DuplicatePolicy = DuplicatePolicy.NONE,
  ) -> int:
      """
      Writes Documents into the DocumentStore.
  
      :param documents: a list of Document objects.
      :param policy: the policy to apply when a Document with the same id already exists in the DocumentStore.
          - `DuplicatePolicy.NONE`: Default policy, behaviour depends on the Document Store.
          - `DuplicatePolicy.SKIP`: If a Document with the same id already exists, it is skipped and not written.
          - `DuplicatePolicy.OVERWRITE`: If a Document with the same id already exists, it is overwritten.
          - `DuplicatePolicy.FAIL`: If a Document with the same id already exists, an error is raised.
      :raises DuplicateError: If `policy` is set to `DuplicatePolicy.FAIL` and a Document with the same id already exists.
      :return: The number of Documents written.
          If `DuplicatePolicy.OVERWRITE` is used, this number is always equal to the number of documents in input.
          If `DuplicatePolicy.SKIP` is used, this number can be lower than the number of documents in the input list.
      """
      ...
  
file_path: haystack/haystack/document_stores/types/protocol.py
imports: from typing import Protocol, Optional, Dict, Any, List
  import logging
  from haystack.dataclasses import Document
  from haystack.document_stores.types.policy import DuplicatePolicy
label_desc: Use image node_id 5 for calling the DocumentStore obj's underlying member method code with example usage: obj.write_documents(documents, policy) without return types