@Test public void count処理でクエリに空のクエリを指定した場合全件数取得できる() { EsIndex index = esClient.idxAdmin("index_for_test"); assertNotNull(index); DataSourceAccessor dsa = new DataSourceAccessor(index, "TypeForTest", "RoutingIdTest"); dsa.create("id00001", new HashMap<Object, Object>()); dsa.create("id00002", new HashMap<Object, Object>()); dsa.create("id00003", new HashMap<Object, Object>()); dsa.create("id00004", new HashMap<Object, Object>()); dsa.create("id00005", new HashMap<Object, Object>()); dsa.create("id00006", new HashMap<Object, Object>()); dsa.create("id00007", new HashMap<Object, Object>()); dsa.create("id00008", new HashMap<Object, Object>()); dsa.create("id00009", new HashMap<Object, Object>()); dsa.create("id00010", new HashMap<Object, Object>()); dsa.create("id00011", new HashMap<Object, Object>()); long response = dsa.count(new HashMap<String, Object>()); assertEquals(11, response); }
public long count(final Map<String, Object> query) { Map<String, Object> requestQuery = null; if (query != null) { requestQuery = new HashMap<String, Object>(query); } else { requestQuery = new HashMap<String, Object>(); } requestQuery.put("size", 0); try { DcSearchResponse hit = this.type.search(requestQuery); return hit.getHits().getAllPages(); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } }
DataSourceAccessor { public long count(final Map<String, Object> query) { Map<String, Object> requestQuery = null; if (query != null) { requestQuery = new HashMap<String, Object>(query); } else { requestQuery = new HashMap<String, Object>(); } requestQuery.put("size", 0); try { DcSearchResponse hit = this.type.search(requestQuery); return hit.getHits().getAllPages(); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } } }
DataSourceAccessor { public long count(final Map<String, Object> query) { Map<String, Object> requestQuery = null; if (query != null) { requestQuery = new HashMap<String, Object>(query); } else { requestQuery = new HashMap<String, Object>(); } requestQuery.put("size", 0); try { DcSearchResponse hit = this.type.search(requestQuery); return hit.getHits().getAllPages(); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } } DataSourceAccessor(EsIndex index); protected  DataSourceAccessor(EsIndex index, String name, String routingId); }
DataSourceAccessor { public long count(final Map<String, Object> query) { Map<String, Object> requestQuery = null; if (query != null) { requestQuery = new HashMap<String, Object>(query); } else { requestQuery = new HashMap<String, Object>(); } requestQuery.put("size", 0); try { DcSearchResponse hit = this.type.search(requestQuery); return hit.getHits().getAllPages(); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } } DataSourceAccessor(EsIndex index); protected  DataSourceAccessor(EsIndex index, String name, String routingId); EsIndex getIndex(); String getType(); DcGetResponse get(final String id); @SuppressWarnings("rawtypes") DcIndexResponse create(final Map data); @SuppressWarnings({"rawtypes" }) DcActionResponse createForDavNodeFile(final String id, final Map data); @SuppressWarnings({"rawtypes" }) DcIndexResponse create(final String id, final Map data); @SuppressWarnings({"rawtypes" }) DcIndexResponse create(final String id, final Map data, final EntitySetDocHandler docHandler); @SuppressWarnings({"rawtypes" }) DcIndexResponse update(final String id, final Map data, final long version); @SuppressWarnings("rawtypes") DcIndexResponse update(final String id, final Map data); long count(final Map<String, Object> query); DcSearchResponse search(final Map<String, Object> query); DcMultiSearchResponse multiSearch(final List<Map<String, Object>> queryList); DcSearchResponse indexSearch(final Map<String, Object> query); DcDeleteResponse delete(final String docId, final long version); DcBulkResponse bulkCreate(List<EsBulkRequest> esBulkRequest,
            List<EntitySetDocHandler> adsBulkRequest,
            String routingId); DcBulkResponse bulkUpdateLink(List<EsBulkRequest> esBulkRequest,
            List<EntitySetDocHandler> adsBulkEntityRequest,
            List<LinkDocHandler> adsBulkLinkRequest,
            String routingId); DcSearchResponse searchForIndex(String routingId, Map<String, Object> query); DcMultiSearchResponse multiSearchForIndex(String routingId, List<Map<String, Object>> queryList); }
DataSourceAccessor { public long count(final Map<String, Object> query) { Map<String, Object> requestQuery = null; if (query != null) { requestQuery = new HashMap<String, Object>(query); } else { requestQuery = new HashMap<String, Object>(); } requestQuery.put("size", 0); try { DcSearchResponse hit = this.type.search(requestQuery); return hit.getHits().getAllPages(); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } } DataSourceAccessor(EsIndex index); protected  DataSourceAccessor(EsIndex index, String name, String routingId); EsIndex getIndex(); String getType(); DcGetResponse get(final String id); @SuppressWarnings("rawtypes") DcIndexResponse create(final Map data); @SuppressWarnings({"rawtypes" }) DcActionResponse createForDavNodeFile(final String id, final Map data); @SuppressWarnings({"rawtypes" }) DcIndexResponse create(final String id, final Map data); @SuppressWarnings({"rawtypes" }) DcIndexResponse create(final String id, final Map data, final EntitySetDocHandler docHandler); @SuppressWarnings({"rawtypes" }) DcIndexResponse update(final String id, final Map data, final long version); @SuppressWarnings("rawtypes") DcIndexResponse update(final String id, final Map data); long count(final Map<String, Object> query); DcSearchResponse search(final Map<String, Object> query); DcMultiSearchResponse multiSearch(final List<Map<String, Object>> queryList); DcSearchResponse indexSearch(final Map<String, Object> query); DcDeleteResponse delete(final String docId, final long version); DcBulkResponse bulkCreate(List<EsBulkRequest> esBulkRequest,
            List<EntitySetDocHandler> adsBulkRequest,
            String routingId); DcBulkResponse bulkUpdateLink(List<EsBulkRequest> esBulkRequest,
            List<EntitySetDocHandler> adsBulkEntityRequest,
            List<LinkDocHandler> adsBulkLinkRequest,
            String routingId); DcSearchResponse searchForIndex(String routingId, Map<String, Object> query); DcMultiSearchResponse multiSearchForIndex(String routingId, List<Map<String, Object>> queryList);  }