def buffer_and_drop(self):
self.elastic_doc.command_helper = CommandHelper()<EOL>self.elastic_doc.auto_commit_interval = None<EOL>index = "<STR_LIT>"<EOL>doc_type = "<STR_LIT:foo>"<EOL>cmd_args = ("<STR_LIT>" % (index, doc_type), <NUM_LIT:1>)<EOL>doc_id = <NUM_LIT:1><EOL>doc = {"<STR_LIT>": doc_id, "<STR_LIT:name>": "<STR_LIT:bar>"}<EOL>self.elastic_doc.upsert(doc, *cmd_args)<EOL>self.elastic_doc.handle_command({"<STR_LIT>": doc_type}, *cmd_args)<EOL>retry_until_ok(self.elastic_conn.indices.refresh, index="<STR_LIT>")<EOL>self.assertFalse(self.elastic_doc.BulkBuffer.get_buffer())<EOL>res = list(<EOL>self.elastic_doc._stream_search(<EOL>index=index, doc_type=doc_type, body={"<STR_LIT>": {"<STR_LIT>": {}}}<EOL>)<EOL>)<EOL>self.assertFalse(res)<EOL>self.elastic_doc.upsert(doc, *cmd_args)<EOL>update_spec = {"<STR_LIT>": {"<STR_LIT:name>": "<STR_LIT>"}}<EOL>self.elastic_doc.update(doc_id, update_spec, *cmd_args)<EOL>self.elastic_doc.handle_command({"<STR_LIT>": <NUM_LIT:1>}, *cmd_args)<EOL>retry_until_ok(self.elastic_conn.indices.refresh, index="<STR_LIT>")<EOL>self.assertFalse(self.elastic_doc.BulkBuffer.get_buffer())<EOL>self.assertNotIn(index, self._mappings())<EOL>self.elastic_doc.auto_commit_interval = <NUM_LIT:0><EOL>
Insert document and drop collection while doc is in buffer