/ factorpad.com / tech / solr / reference / solr-create.html
An ad-free and cookie-free website.
Beginner
Many people test Apache Solr search during their evaluation of options for enterprise search and website search. Two common options exist. First, offerings provided by Google Custom Search or Amazon CloudSearch offer a managed search option. Others evaluate building their own applications using Apache Solr and Elasticsearch.
Any comprehensive review requires building a test environment which is normally performed in one-server standalone mode. Next, as search volumes increase it is important to review distributed search offerings and in Apache Solr that sits in SolrCloud mode.
Tests in Solr require building test data sets and configurations
for managing the search application. Here with
solr create
you can create either a
core for standalone mode in a testing environment. This command can
also be used to create a collection for SolrCloud mode.
The solr create
command will
automatically detect the mode when it creates either the core or
collection. If you know which one you want to create you can jump
straight to the solr create_core
for
standalone mode, or
solr create_collection
for SolrCloud
mode. Alternatively, you can stick with
solr create
.
The solr create
command is one of 12
commands within the main solr
script.
The solr create
command itself has 6
options, also known as parameters.
The syntax for running solr create
is
as follows.
The list of 6 options including default values are described in the table below.
This syntax assumes your current working directory is
the $SOLR_HOME directory for Solr, which for version 7
would be ~/solr-7.0.0/
in
standalone mode for a local installation. When running in a production
environment the directory locations may differ.
So the path to the location of the solr script is:
~/solr-7.0.0/bin/solr
. Alternatively,
the solr
script can be run using the
convention ./solr
from within
the bin
directory.
When using a Solr Windows installation, the solr script is called using
solr.cmd
.
For the solr create
command the
-c
option is required. The other
options (parameters) are optional.
Syntax | Purpose | Default |
---|---|---|
bin/solr create with only
-c <name> input |
Create a Solr core or collection with default options named <name>. |
|
-c <name> |
Select a name for the core (standalone mode) or collection (SolrCloud mode). | -c <name> is required |
-d <confdir> |
Select the configuration directory contents to copy to the
core in standalone mode or collection in SolrCloud mode.
Currently two options exist:
|
_default |
-n <configName> (SolrCloud
mode only) |
This option is only available in SolrCloud mode. Also it is optional. You can select a name for the configuration directory set up by the -d <confdir> option. By default the name selected will match that selected with -c <name> and contents will be copied to it from the _default directory. This option is provided if a desired configuration directory already exists. | <name> from the -c option |
-shards <#> or
-s <#> (SolrCloud
mode only) |
Set the number of shards to split the collection into. | 1 |
-rf <#> (SolrCloud mode
only) |
Set the number of copies of each document in the collection. The option can be specified using the long form -replicationFactor <#> as well. | 1 (not replicated) |
-p <port> |
Select the port on the server where Solr should create the core or collection. | Solr selects the first running server |
The following command creates a Solr core named mycore creating a new configuration set called mycore by copying configurations from /server/solr/configsets/_default.
The following command will create a Solr core called mycore on port number 8984 instead of the default 8983. This also creates configuration directory called mycore with a copy of contents from /server/solr/configsets/_default.
The following command will create a Solr collection with the name mycollection on port 8983.
The following command will create a Solr collection named mycollection copying the techproducts configuration to a directory called myconfigs.
The following command will create a Solr collection named mycollection with 2 shards and 2 replicas using the _default configurations copied and named mycollection.
From the command line you can access additional help on the
solr create_core
command by appending
-help
after the command. The help
provided by bin/solr create -help
is
limited.
From the command line you can access additional help on the
solr create_collection
command by
appending -help
after the command.
FactorPad offers Apache Solr Search content in both tutorials and reference.
Learn Apache Solr using a more linear approach with our video tutorials offered for free at our YouTube Channel.
/ factorpad.com / tech / solr / reference / solr-create.html
A newly-updated free resource. Connect and refer a friend today.