class_docstr: Search commands.
docstr: Internal add_document used for both batch and single doc indexing
docstr_tok: ["Internal","add_document","used","for","both","batch","and","single","doc","indexing"]
code: def _add_document(
      self,
      doc_id,
      conn=None,
      nosave=False,
      score=1.0,
      payload=None,
      replace=False,
      partial=False,
      language=None,
      no_create=False,
      **fields,
  ):
      """
      Internal add_document used for both batch and single doc indexing
      """
  
      if partial or no_create:
          replace = True
  
      args = [ADD_CMD, self.index_name, doc_id, score]
      if nosave:
          args.append("NOSAVE")
      if payload is not None:
          args.append("PAYLOAD")
          args.append(payload)
      if replace:
          args.append("REPLACE")
          if partial:
              args.append("PARTIAL")
          if no_create:
              args.append("NOCREATE")
      if language:
          args += ["LANGUAGE", language]
      args.append("FIELDS")
      args += list(itertools.chain(*fields.items()))
  
      if conn is not None:
          return conn.execute_command(*args)
  
      return self.execute_command(*args)
  
imports: import itertools
  import time
  from typing import Dict, List, Optional, Union
  from redis.client import Pipeline
  from redis.utils import deprecated_function
  from ..helpers import get_protocol_version, parse_to_dict
  from ._util import to_string
  from .aggregation import AggregateRequest, AggregateResult, Cursor
  from .document import Document
  from .query import Query
  from .result import Result
  from .suggestion import SuggestionParser
label_desc: Use image node_id 13 for calling the SearchCommands obj's underlying member method code with example usage: obj._add_document(doc_id, conn, nosave, score, payload, replace, partial, language, no_create) and returns: self, conn