@Test public void testGetSlash() { final String id = "get-test/id-2"; final IndexRequestBuilder indexRequestBuilder = restClient().prepareIndex(index, type, id).setSource("field", "value").setRefresh(true); indexRequestBuilder.execute().actionGet(); final GetRequestBuilder getRequestBuilder = restClient().prepareGet(index, type, id); final ListenableActionFuture<GetResponse> execute1 = getRequestBuilder.execute(); final GetResponse get = execute1.actionGet(); assertEquals(get.getIndex(), index); assertEquals(get.getType(), type); assertEquals(get.getId(), id); assertEquals(get.getVersion(), 1); assertTrue(get.getFields().isEmpty()); assertEquals(get.getSource().get("field"), "value"); }
/** * Get the river definition by its name * * @param name * @return */ public T get(String name) { if (logger.isDebugEnabled()) logger.debug("get({})", name); T river = null; if (name != null) { GetRequestBuilder rb = new GetRequestBuilder(client, SMDSearchProperties.ES_META_INDEX); rb.setType(SMDSearchProperties.ES_META_RIVERS); rb.setId(name); try { GetResponse response = rb.execute().actionGet(); if (response.isExists()) { river = getHelper().toRiver(buildInstance(), response.getSourceAsMap()); } } catch (IndexMissingException e) { // Index does not exists, so RIVER does not exist... } } if (logger.isDebugEnabled()) logger.debug("/get({})={}", name, river); return river; }