docs: def index(self, doc, index, doc_type, id=None, parent=None, force_insert=False,
                op_type=None, bulk=False, version=None, querystring_args=None, ttl=None):
          """
          Index a typed JSON document into a specific index and make it searchable.
          """
          if querystring_args is None:
              querystring_args = {}
  
          if bulk:
              if op_type is None:
                  op_type = "index"
              if force_insert:
                  op_type = "create"
              cmd = {op_type: {"_index": index, "_type": doc_type}}
              if parent:
                  cmd[op_type]['_parent'] = parent
              if version:
                  cmd[op_type]['_version'] = version
              if 'routing' in querystring_args:
                  cmd[op_type]['_routing'] = querystring_args['routing']
              if 'percolate' in querystring_args:
                  cmd[op_type]['percolate'] = querystring_args['percolate']
              if id is not None:  #None to support 0 as id
                  cmd[op_type]['_id'] = id
              if ttl is not None:
                  cmd[op_type]['_ttl'] = ttl
  
              if isinstance(doc, dict):
                  doc = json.dumps(doc, cls=self.encoder)
              command = "%s\n%s" % (json.dumps(cmd, cls=self.encoder), doc)
              self.bulker.add(command)
              return self.flush_bulk()
  
          if force_insert:
              querystring_args['op_type'] = 'create'
          if op_type:
              querystring_args['op_type'] = op_type
  
          if parent:
              if not isinstance(parent, str):
                  parent = str(parent)
              querystring_args['parent'] = parent
  
          if version:
              if not isinstance(version, str):
                  version = str(version)
              querystring_args['version'] = version
  
          if ttl is not None:
              if not isinstance(ttl, str):
                  ttl = str(ttl)
              querystring_args['ttl'] = ttl
  
          if id is None:
              request_method = 'POST'
          else:
              request_method = 'PUT'
  
          path = make_path(index, doc_type, id)
          return self._send_request(request_method, path, doc, querystring_args)