Core admin queries can be used to administrate cores on your solr server (https://lucene.apache.org/solr/guide/7_4/coreadmin-api.html)
The core admin api on the Apache Solr server has several "actions" available and every action can have a set of arguments.
The following example shows how your can build a core admin query that executes the status action:
<?php
require(__DIR__.'/init.php');
htmlHeader();
// create a client instance
$client = new Solarium\Client($config);
// create a core admin query
$coreAdminQuery = $client->createCoreAdmin();
// use the core admin query to build a Status action
$statusAction = $coreAdminQuery->createStatus();
$statusAction->setCore('techproducts');
$coreAdminQuery->setAction($statusAction);
$response = $client->coreAdmin($coreAdminQuery);
$statusResult = $response->getStatusResult();
echo '<b>Core admin status action execution:</b><br/>';
echo 'Uptime of the core ( ' .$statusResult->getCoreName(). ' ): ' . $statusResult->getUptime();
htmlFooter();
Beside the status action there are several actions available that can be created with the createActionName() method.
The api implements the following actions
Use to create a new core.
Available action methods:
Name | Arguments | Description |
---|---|---|
setAsync | string $async | Identifier for async execution to request the status later |
setCore | string $core | Name of the core |
setInstanceDir | string $instanceDir | Instance dir that should be used |
setConfig | string $config | Name of the config file relative to the instanceDir |
setSchema | string $schema | Name of the schema file |
setDataDir | string $dataDir | Name of the dataDir relative to the instance dir |
setConfigSet | string $configSet | Name of the configSet that should be used |
setCollection | string $collection | Name of the collection where this core belongs to |
setShard | string $shard | ShardId that this core represents |
setCoreProperty | string $name, string $value | Entry for the core.properties file, can be used n times |
Use to merge cores.
Available action methods:
Name | Arguments | Description |
---|---|---|
setAsync | string $async | Identifier for async execution to request the status later |
setCore | string $core | Name of the core where the data should be merged into |
setIndexDir | array $indexDir | Array of index directories that should be merged |
setSrcCore | array $srcCore | Array of source cores that should be merged |
Use to reload a core.
Available action methods:
Name | Arguments | Description |
---|---|---|
setCore | string $core | Name of the core that should be reloaded |
Use to rename a core.
Available action methods:
Name | Arguments | Description |
---|---|---|
setAsync | string $async | Identifier for async execution to request the status later |
setCore | string $core | Name of the core that should be renamed |
setOther | string $otherCoreName | New name of the core |
Use to recover a core.
Note: Only relevant for solrcloud where cores are shards and a cover can be recovered from the leader (a copy of that core on another node)
Available action methods:
Name | Arguments | Description |
---|---|---|
setCore | string $core | Name of the core that should be recovered |
Use to get the status from an asynchronous request. When you have previously passed an async identifier for another action, RequestStatus can be used later to retrieve the state for that asynchronous action.
Available action methods:
Name | Arguments | Description |
---|---|---|
setRequestId | string $requestId | Id of the asynchronous request that was previously executed. |
Use to split a core.
See also: https://lucene.apache.org/solr/guide/7_4/coreadmin-api.html#coreadmin-split
Available action methods:
Name | Arguments | Description |
---|---|---|
setAsync | string $async | Identifier for async execution to request the status later |
setCore | string $core | Name of the core that should be renamed |
setPath | array $path | Array of pathes where the parts of the splitted index is written |
setTargetCore | array $targetCore | Array of target core names that should be used for splitting |
setRanges | string $ranges | Comma separated list of hash ranges in hexadecimal format |
setSplitKey | string $splitKey | Key to be used for splitting the index |
Use to get the status of one or all cores:
Note: When no name is passed the status for all cores will be retrieved.
Available action methods:
Name | Arguments | Description |
---|---|---|
setCore | string $core | Optional name of the core where the status should be retrieved |
Use to swap a core.
Available action methods:
Name | Arguments | Description |
---|---|---|
setAsync | string $async | Identifier for async execution to request the status later |
setCore | string $core | Name of the core that should be swap |
setOther | string $otherCoreName | Target core to swap with |
Use to unload a core.
Available action methods:
Name | Arguments | Description |
---|---|---|
setAsync | string $async | Identifier for async execution to request the status later |
setCore | string $core | Name of the core that should be swap |
setDeleteIndex | bool $boolean | Deletes the index directory |
setDeleteDataDir | bool $boolean | Deletes the data directory |
setDeleteInstanceDir | bool $boolean | Deletes the instance directory |