@Test public void testScan() { System.out.println("scan"); int recordcount = 10; Set<String> fields = MOCK_DATA.keySet(); Vector<HashMap<String, ByteIterator>> resultParam = new Vector<HashMap<String, ByteIterator>>(10); int expResult = 0; int result = instance.scan(MOCK_TABLE, MOCK_KEY1, recordcount, fields, resultParam); assertEquals(expResult, result); }
@Override public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeFilterBuilder filter = rangeFilter("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(matchAllQuery()) .setFilter(filter) .setSize(recordcount) .execute() .actionGet(); HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return 0; } catch (Exception e) { e.printStackTrace(); } return 1; }
ElasticSearchClient extends DB { @Override public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeFilterBuilder filter = rangeFilter("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(matchAllQuery()) .setFilter(filter) .setSize(recordcount) .execute() .actionGet(); HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return 0; } catch (Exception e) { e.printStackTrace(); } return 1; } }
ElasticSearchClient extends DB { @Override public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeFilterBuilder filter = rangeFilter("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(matchAllQuery()) .setFilter(filter) .setSize(recordcount) .execute() .actionGet(); HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return 0; } catch (Exception e) { e.printStackTrace(); } return 1; }  }
ElasticSearchClient extends DB { @Override public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeFilterBuilder filter = rangeFilter("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(matchAllQuery()) .setFilter(filter) .setSize(recordcount) .execute() .actionGet(); HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return 0; } catch (Exception e) { e.printStackTrace(); } return 1; }  @Override void init(); @Override void cleanup(); @Override int insert(String table, String key, HashMap<String, ByteIterator> values); @Override int delete(String table, String key); @Override int read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result); @Override int update(String table, String key, HashMap<String, ByteIterator> values); @Override int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result); }
ElasticSearchClient extends DB { @Override public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeFilterBuilder filter = rangeFilter("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(matchAllQuery()) .setFilter(filter) .setSize(recordcount) .execute() .actionGet(); HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return 0; } catch (Exception e) { e.printStackTrace(); } return 1; }  @Override void init(); @Override void cleanup(); @Override int insert(String table, String key, HashMap<String, ByteIterator> values); @Override int delete(String table, String key); @Override int read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result); @Override int update(String table, String key, HashMap<String, ByteIterator> values); @Override int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result); static final String DEFAULT_CLUSTER_NAME; static final String DEFAULT_INDEX_KEY; }