String id = in.getId().toString();
logger.debug("GridFS in: {}", in);
logger.debug("Document created with id: {}", id);
GridFSDBFile out = gridFS.findOne(in.getFilename());
logger.debug("GridFS from findOne: {}", out);
out = gridFS.findOne(new ObjectId(id));
logger.debug("GridFS from findOne: {}", out);
Assert.assertEquals(out.getId(), in.getId());
createRiver();
Thread.sleep(wait);
refreshIndex();
CountResponse countResponse = getNode().client().count(countRequest(getIndex())).actionGet();
logger.debug("Index total count: {}", countResponse.getCount());
assertThat(countResponse.getCount(), equalTo(1l));
GetResponse getResponse = getNode().client().get(getRequest(getIndex()).id(id)).get();
logger.debug("Get request for id {}: {}", id, getResponse.isExists());
assertThat(getResponse.isExists(), equalTo(true));
SearchResponse response = getNode().client().prepareSearch(getIndex()).setQuery(QueryBuilders.queryString("Aliquam")).execute()
.actionGet();
logger.debug("SearchResponse {}", response.toString());
long totalHits = response.getHits().getTotalHits();
logger.debug("TotalHits: {}", totalHits);
assertThat(totalHits, equalTo(1l));
in = gridFS.createFile(content);
in.setFilename("test-attachment-2.html");
in.setContentType("text/html");
in.save();
in.validate();
id = in.getId().toString();
out = gridFS.findOne(in.getFilename());
logger.debug("GridFS from findOne: {}", out);
out = gridFS.findOne(new ObjectId(id));
logger.debug("GridFS from findOne: {}", out);
Assert.assertEquals(out.getId(), in.getId());
Thread.sleep(wait);
refreshIndex();
countResponse = getNode().client().count(countRequest(getIndex())).actionGet();