private void createAlias(final int jettyPort, final String aliasName, final String aliasedCollections) throws IOException { final String url = "http://localhost:" + jettyPort + "/solr/admin/collections?action=CREATEALIAS" + "&name=" + aliasName + "&collections=" + aliasedCollections; final HttpGet request = new HttpGet(url); try (final CloseableHttpClient client = HttpClientBuilder.create().build(); final CloseableHttpResponse response = client.execute(request)) { final HttpEntity entity = response.getEntity(); System.out.println(IOUtils.toString(entity.getContent(), "UTF-8")); // close the content stream. EntityUtils.consumeQuietly(entity); } }
private void deleteAlias(final int jettyPort, final String aliasName) throws IOException { final String url = "http://localhost:" + jettyPort + "/solr/admin/collections?action=DELETEALIAS" + "&name=" + aliasName; final HttpGet request = new HttpGet(url); try (final CloseableHttpClient client = HttpClientBuilder.create().build(); final CloseableHttpResponse response = client.execute(request)) { final HttpEntity entity = response.getEntity(); System.out.println(IOUtils.toString(entity.getContent(), "UTF-8")); // close the content stream. EntityUtils.consumeQuietly(entity); } }