@Test public void search処理でクエリにサイズを指定した場合指定したサイズのドキュメントが取得できる() { 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>()); Map<String, Object> query = new HashMap<String, Object>(); query.put("size", 3); DcSearchResponse response = dsa.search(query); assertEquals(5, response.getHits().getAllPages()); assertEquals(3, response.getHits().getCount()); }
public DcSearchResponse search(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>(); } if (!requestQuery.containsKey("size")) { requestQuery.put("size", this.count(query)); } try { return this.type.search(requestQuery); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } }
DataSourceAccessor { public DcSearchResponse search(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>(); } if (!requestQuery.containsKey("size")) { requestQuery.put("size", this.count(query)); } try { return this.type.search(requestQuery); } catch (EsClientException.EsNoResponseException e) { throw DcCoreException.Server.ES_RETRY_OVER.params(e.getMessage()); } } }
DataSourceAccessor { public DcSearchResponse search(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>(); } if (!requestQuery.containsKey("size")) { requestQuery.put("size", this.count(query)); } try { return this.type.search(requestQuery); } 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 DcSearchResponse search(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>(); } if (!requestQuery.containsKey("size")) { requestQuery.put("size", this.count(query)); } try { return this.type.search(requestQuery); } 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 DcSearchResponse search(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>(); } if (!requestQuery.containsKey("size")) { requestQuery.put("size", this.count(query)); } try { return this.type.search(requestQuery); } 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);  }