class_docstr: Search commands.
docstr: Delete a document from index
  Returns 1 if the document was deleted, 0 if not
  
  ### Parameters
  
  - **delete_actual_document**: if set to True, RediSearch also delete
                                the actual document if it is in the index
docstr_tok: ["Delete","a","document","from","index","Returns","1","if","the","document","was","deleted",",","0","if","not","#","#","#","Parameters","-","*","*","delete_actual_document","*","*",":","if","set","to","True",",","RediSearch","also","delete","the","actual","document","if","it","is","in","the","index"]
code: def delete_document(
      self, doc_id, conn=None, delete_actual_document=False
  ):
      """
      Delete a document from index
      Returns 1 if the document was deleted, 0 if not
  
      ### Parameters
  
      - **delete_actual_document**: if set to True, RediSearch also delete
                                    the actual document if it is in the index
      """  # noqa
      args = [DEL_CMD, self.index_name, doc_id]
      if delete_actual_document:
          args.append("DD")
  
      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 17 for calling the SearchCommands obj's underlying member method code with example usage: obj.delete_document(doc_id, conn, delete_actual_document) and returns: self, conn