code: def _docs(self):
          
          iterdocs = iter(self.docs())
          first = next(iterdocs)
          needs_parsing = False
          if isinstance(first, six.string_types):
              needs_parsing = True
          elif isinstance(first, dict):
              pass
          else:
              raise RuntimeError('Document must be either JSON strings or dict.')
          for doc in itertools.chain([first], iterdocs):
              if needs_parsing:
                  doc = json.loads(doc)
              if '_index' not in doc:
                  doc['_index'] = self.index
              if '_type' not in doc:
                  doc['_type'] = self.doc_type
              yield doc
docs: Since `self.docs` may yield documents that do not explicitly contain `_index` or `_type`,
          add those attributes here, if necessary.