omitHeader=true
wt=json
indent=true
private void listConfigSets(final int jettyPort) throws IOException { final String url = "http://localhost:" + jettyPort + "/solr/admin/configs?action=LIST"; 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); } }
solrconfig.xml
", ...) are directly located.
Solr configuration files must be the top level entry in the zip file.$ (cd /opt/solr/server/solr/configsets/_default/conf && zip -r - *) > /opt/solr/_defaultUploadedConfigSet.zip
$ curl -X POST \ --header "Content-Type:application/octet-stream" \ --data-binary @/opt/solr/_defaultUploadedConfigSet.zip \ "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=_defaultUploadedConfigSet"
$ (cd /opt/solr/server/solr/configsets/_default/conf && zip -r - *) | curl -X POST \ --header "Content-Type:application/octet-stream" \ --data-binary @- \ "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=_defaultUploadedConfigSet1"
configSetName
") based on an existing Configset ("baseConfigSetName
").configSetProp.immutable=true
"),
which means it cannot be edited or deleted and its Schema cannot be updated by the Schema API.$ curl -X POST -H 'Content-type: application/json' \ -d '{ "create":{ "name": "_default2", "baseConfigSet": "_default" } }' \ http://localhost:8983/api/cluster/configs?configSetProp.immutable=false
private void createConfigSet(final int jettyPort, final String configSetName, final String baseConfigSetName) throws IOException { final String url = "http://localhost:" + jettyPort + "/solr/admin/configs?action=CREATE" + "&name=" + configSetName + "&baseConfigSet=" + baseConfigSetName + "&configSetProp.immutable=false"; 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); } }
$ curl -X DELETE http://localhost:8983/api/cluster/configs/_default2
private void deleteConfigSet(final int jettyPort, final String configSetName) throws IOException { final String url = "http://localhost:" + jettyPort + "/solr/admin/configs?action=DELETE" + "&name=" + configSetName; 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); } }