Hello TC,
Kais Hassan

The Elevate.xml file was being created at C:\configs\{collection name}\elevate.xml by the plugin but this does not result in an update of the actual file visible in the Admin Console, hence the differences. I assume this is because Zookeeper is in control of the config files. I tested running a query to confirm that the Elevate.xml file was not updated ‘server side’.

The solution I have come up with is to modify the plugin so it first downloads the config from Zookeeper, modifies the downloaded Elevate.xml file and then uploads it back to Zookeeper. This is achieved using the CloudSolrClient object, for example:

String resourcePath = CloudUtil.unifiedResourcePath(context.getSolrCore().getSolrConfig().getResourceLoader());
 String absoluteDataPath = new File(context.getSolrCore().getDataDir()).getAbsolutePath();
 String absoluteResourcePath = new File(resourcePath).getAbsolutePath(); 
 CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost(“localhost:9983”).build();
 Path configPath = Paths.get(absoluteResourcePath);
 cloudSolrClient.downloadConfig(“MyCollection”, configPath);
 …modify the Elevate.xml file downloaded…
 cloudSolrClient.uploadConfig(configPath, “MyCollection”);

Show your support

Clapping shows how much you appreciated TC Cummins’s story.