How to import data from one solr core to another solr instance

Tam picture Tam · May 11, 2016 · Viewed 9k times · Source

I need to import data from one Solr instance to another instance Full data and index import.

I have searched and spend some times in google but I did not find proper solution. This link has similar question but i could not find the proper answer.

I am new to Solr hope I will be some help.

I Have one live running instance running in remote box I need to have similar data set in another data. So I am thinking full data import should be possible.

My question here is :

  • Does existing Solr support full data set import or any tools? or
  • I need write some custom data handler for this purpose?

Thanks in advance for any kind of help or information.

Answer

duvo picture duvo · Oct 25, 2017

You can use Solr DataImportHandler to import data from one Solr instance to another.

  1. Update the solrconfig.xml to configure DataImportHandler settings

    <requesthandler class="org.apache.solr.handler.dataimport.DataImportHandler" name="/dataimport">
    <lst name="defaults">
        <str name="config">solr-data-config.xml</str>
    </lst>
    

  2. Enter the following in data-config.xml.

    <dataConfig>
    <document>
       <entity name="solr_doc" processor="SolrEntityProcessor" 
        query="mimeType:pdf" 
        url="http://your.solr.server:8983/solr/your-core">
       </entity>
    </document>
    </dataConfig>
    
  3. Go to destination Solr admin console, click on DataImport, select "solr_doc" from the Entity drop down, and click on Execute.

I found the following links useful

http://blog.trifork.com/2011/11/08/importing-data-from-another-solr/ https://wiki.apache.org/solr/DataImportHandler#SolrEntityProcessor