ElasticSearch { @Procedure @Description("apoc.es.stats(host-url-Key) - elastic search statistics") public Stream<MapResult> stats(@Name("host") String hostOrKey) { String url = getElasticSearchUrl(hostOrKey); return LoadJson.loadJsonStream(url + "/_stats", null, null); }  @Procedure @Description("apoc.es.stats(host-url-Key) - elastic search statistics") Stream<MapResult> stats(@Name("host") String hostOrKey); @Procedure @Description("apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a GET operation on elastic search") Stream<MapResult> get(@Name("host") String hostOrKey, @Name("index") String index, @Name("type") String type, @Name("id") String id, @Name("query") Object query, @Name("payload") Object payload); @Procedure @Description("apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a SEARCH operation on elastic search") Stream<MapResult> query(@Name("host") String hostOrKey, @Name("index") String index, @Name("type") String type, @Name("query") Object query, @Name("payload") Object payload); @Procedure @Description("apoc.es.getRaw(host-or-port,path,payload-or-null) yield value - perform a raw GET operation on elastic search") Stream<MapResult> getRaw(@Name("host") String hostOrKey, @Name("path") String suffix, @Name("payload") Object payload); @Procedure @Description("apoc.es.postRaw(host-or-port,path,payload-or-null) yield value - perform a raw POST operation on elastic search") Stream<MapResult> postRaw(@Name("host") String hostOrKey, @Name("path") String suffix, @Name("payload") Object payload); @Procedure @Description("apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a POST operation on elastic search") Stream<MapResult> post(@Name("host") String hostOrKey, @Name("index") String index, @Name("type") String type, @Name("query") Object query, @Name(value = "payload", defaultValue = "{}") Map<String,Object> payload); @Procedure @Description("apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a PUT operation on elastic search") Stream<MapResult> put(@Name("host") String hostOrKey, @Name("index") String index, @Name("type") String type, @Name("id") String id, @Name("query") Object query, @Name(value = "payload", defaultValue = "{}") Map<String,Object> payload);  }
@Test public void testStats() throws Exception { TestUtil.testCall(db, "CALL apoc.es.stats($host)", defaultParams, r -> { assertNotNull(r.get("value")); Object numOfDocs = extractValueFromResponse(r, "$._all.total.docs.count"); assertNotEquals(0, numOfDocs); }); }