I'm trying to Automate some of the Setup of Solr Core's for Sitecore 10.3 and everything works fine - apart from one thing which is that there is a requirement to set update.autoCreateFields=false
in the core.properties
file like so and I can't seem to get this to work via the API:
name=[CORE_NAME]
config=solrconfig.xml
update.autoCreateFields=false
dataDir=data
I tried setting it when creating the core but it seems to be ignored:
function Create-SolrCore($solrBaseUrl, $coreName) {
$restUrl = "{0}/admin/cores?action=CREATE&name={1}&configSet={2}&dataDir=data&update.autoCreateFields=true" -f $solrBaseUrl, $coreName, $SolrConfigSetName
Write-Host "Creating Solr core - $coreName : $restUrl ..."
$result = Invoke-WebRequest $restUrl -Method GET -UseBasicParsing
Write-Host "Created Solr core: $coreName. - $($result)"
}
I also tried like so using the set-user-property request but it still seems to have no affect:
function Set-CoreProperty($solrBaseUrl, $coreName) {
$restUrl = "{0}/collection/config" -f $solrBaseUrl, $coreName
Write-Host "Setting Property for core - $coreName : $restUrl ..."
$result = Invoke-WebRequest $restUrl -Method POST -ContentType "application/json" -Body "{`"set-user-property`":{`"update.autoCreateFields`":true}}"
Write-Host "Property set for Solr core: $coreName. - $($result)"
}
Any input on how best to go about automating this would be appreciated.
I guess if it's not possible via the APIs I could set this in the solr.config file that is used by all my Core's and that should work? but I'd rather not have to make manual updates:
<!-- The update.autoCreateFields property can be turned to false to disable schemaless mode -->
<updateRequestProcessorChain name="add-unknown-fields-to-the-schema" default="${update.autoCreateFields:true}"
processor="uuid,remove-blank,field-name-mutating,parse-boolean,parse-long,parse-double,parse-date,add-schema-fields">
<processor class="solr.LogUpdateProcessorFactory"/>
<processor class="solr.DistributedUpdateProcessorFactory"/>
<processor class="solr.RunUpdateProcessorFactory"/>
</updateRequestProcessorChain>
More info on the steps here: https://doc.sitecore.com/xp/en/developers/103/platform-administration-and-architecture/walkthrough--setting-up-solr.html