SOLR Admin Core Commands

It is assumed that Solr is installed in your local machine and at port 8080. If different, change the URL and port accordingly.

SOLR Core Status

If you want to know the status of multiple cores or status of the instance if no cores, by visiting the below URL from your browser.

http://127.0.0.1:8080/solr/admin/cores?action=STATUS

If you want to know the status of any single core in particular, say core1, visit

http://127.0.0.1:8080/solr/admin/cores?action=STATUS&core=core1

Reload SOLR Core

If you want the configuration changes you have done in schema.xml or solrconfig.xml to take effect without restart of whole instance, you can just reload the specific core you want to reload. By reloading the specific core, your downtime is virtually zero. Use the following URL to load new configuration without restarting.

http://127.0.0.1:8080/solr/admin/cores?action=RELOAD&core=core1

Deleting SOLR core in Runtime

In rare case, where you want to delete or unload the SOLR core, You can do so by visiting,

http://127.0.0.1:8080/solr/admin/cores?action=UNLOAD&core=core1
If you wish to delete the index on unload, you can pass deleteindex as an optional parameter to the URL above with value true.

Refresh SOLR Index

If you want to refresh the index documents in SOLR after deleting the solr index and remove all the documents currently indexed in SOLR, you can use the following URL to perform the SOLR index flush. This URL clears the current SOLR index and does a fresh import from the data source. In case you do not have multiple cores, just remove the core name (core1) from the URL below.

http://127.0.0.1:8080/solr/core1/dataimport?command=full-import
By default, the existing index is cleaned up before indexing starts and the new data is committed after the indexing operation. You can override the behaivour by sending extra parameters,

http://127.0.0.1:8080/solr/core1/dataimport?command=full-import&clean=true&commit=true
If the commit is set to false, the indexed data is not commited. If clean is set to false, the old index is not cleared and stale data will be served.

In case, you want to perfrom a delta import into SOLR, You can do so using the URL below,

http://127.0.0.1:8080/solr/core1/dataimport?command=delta-import
The status of the data import can be monitored at

http://127.0.0.1:8080/solr/core1/dataimport?command=status

Reloading Configuration of DataImportHandler

On configuration changes, you can reload the configuration changes from the file without restarting the SOLR instance by the URL below.

http://127.0.0.1:8080/solr/core1/dataimport?command=reload-config
In case you want to stop the data import operation in SOLR,

http://127.0.0.1:8080/solr/core1/dataimport?command=abort
In case of single core instance, remove the core name (core1) from above URLs and it should work fine..

Solr query fields explained

q: This is the search query. For example to find all documents with monkey in a field called name use name:”monkey”. Documentation can be found here 

fq: Filter Query – This parameter can be used to specify a query that can be used to restrict the super set of documents that can be returned, without influencing score. It can be very useful for speeding up complex queries since the queries specified with fq are cached independently from the main query. Caching means the same filter is used again for a later query (i.e. there’s a cache hit).

sort: Applies sorting to the results set i.e. price asc or score desc

start: Applies an offset, by default start is 0 (first document). However its possible to start further along the dataset by setting the start value.

rows: Specifies how many rows to return, the default is 10.

fl: Specifies which fields to show, leaving this blank returns all fields, i.e. id name price

df: Sets the default field.

Raw Query Parameters: Allows specific values to be inserted into the query such as field1=”test”

wt: This specified what format the results are returned in. The default is JSON however there are a number of different options such as XML and CSV

Solr – Restarting a core with restarting entire Solr instance

Some config changes to Solr require a restart. However since Solr 4.0 it’s possible to restart individual cores without restarting the entire instance.

To restart a core enter http://localhost:8983/solr/admin/cores?action=RELOAD&core=core0 where core0 is the name of the core to restart, that’s it.

This will also schema.xml and solrconfig.xml changes without bring the entire Solr instance down.

However there are few configuration changes which still needs, the restart of SOLR instance,
1) IndexWriter related settings in
2) Change in location