How to work with Apache Solr REST APIs?

                         Smart Techie

                         In this article we will discuss the available Apache Solr REST APIs. We will categorize the REST APIs as shown below. Apache Solr

Data Import REST APIs:

        Command: full-import

        Description: This will start the new indexing thread to index the data.

        Resource URL: http:// < host >:/solr/<solr_core_name>/dataimport?command=full-import

        Parameters:  

  • clean – The default value is false. This tells whether to clean up the index before the indexing is started.
  • commit – The default value is true. This tells whether to commit the index after the operation.
  • debug – The default value is false. This is helpful to understand what is going during the indexing.
  • entity – This tells the Solr to index which entity to index. If nothing is passed all the entities are executed.
  • optimize – The default value is true. This tells whether to optimize the index after the operation.

       Command: delta-import

       Description: This will the changes and index only the changes happened from the last full-import.

        Resource URL: http:// < host >:/solr/<solr_core_name>/dataimport?command=delta-import

        Parameters:

  • clean – The default value is false. This tells whether to clean up the index before the indexing is started.
  • commit – The default value is true. This tells whether to commit the index after the operation.
  • debug – The default value is false. This is helpful to understand what is going during the indexing.
  • entity – This tells the Solr to index which entity to index. If nothing is passed all the entities are executed.
  • optimize – The default value is true. This tells whether to optimize the index after the operation.

        Command: abort

     Description: aborts the running process. For example, during the indexing if we want to stop it, we can use abort  operation.

         Resource URL: http:// :/solr/<solr_core_name>/dataimport?command=abort

          Command: reload-config

       Description: If we want to reload the configuration changes with out restarting the Solr, we can use reload-config.

       Resource URL: http:// :/solr/<solr_core_name>/dataimport?command=reload-config

       Command: status

       Description: It returns the statistics on number of documents indexed, no of documents deleted etc..

Index Replication REST APIs:

       Command: indexversion

       Description: To know the latest index version on the Master.

       Resource URL: http:// master_host:port/solr/replication?command=indexversion

       Command: abortfetch

       Description: It aborts the copying of index from master to slave.

       Resource URL: http:// slave_host:port/solr/replication?command=abortfetch

       Command: backup

       Description: It helps to take the periodic backups of the index from master.

       Resource URL: http:// master_host:port/solr/replication?command=backup

       Parameters:

  • location – to specify where to keep the backups.
  • numberToKeep – to specify how many backups to retain on the specified backups location.

       Command: fetchIndex

       Description: To force the index to replicate from master to slave.

       Resource URL: http:// slave_host:port/solr/replication?command=fetchindex

       Command:  disablepoll

       Description: Disable the polling from slave for the index changes.

       Resource URL: http:// slave_host:port/solr/replication?command=disablepoll

       Command: enablepoll

       Description: Enable polling for changes.

       Resource URL: http:// slave_host:port/solr/replication?command=enablepoll

       Command: details

        Description: To get all the configuration details.

       Resource URL: http:// slave_host:port/solr/replication?command=details

       Command: indexversion

       Description: To get the latest index version.

       Resource URL: http:// host:port/solr/replication?command=indexversion

       Command: disablereplication

       Description: To disable the replication for all slaves.

       Resource URL: http:// master_host:port/solr/replication?command=disablereplication

       Command: enablereplication

       Description: To enable the replication for all slaves from master.

       Resource URL: http:// master_host:port/solr/replication?command=enablereplication

  CoreAdminHandler REST APIs:

       Command: STATUS

       Description: To know the status of a given core or all.

       Resource URL: http:// :/solr/admin/cores?action=STATUS

       Parameters:

  • core – to know only the specified core status.

       Command: RELOAD

        Description: To load a new core from the existing configuration.

         Resource URL: http:// :/solr/admin/cores?action=RELOAD&core=core0

        Command: RENAME

        Description: To rename the Solr cores.

         Resource URL: http:// :/solr/admin/cores?action=RENAME&core=core0&other=core5

        Command: SWAP

        Description: To swap the names of the cores.

        Resource URL: http:// <host>:<port>/solr/admin/cores?action=SWAP&core=core1&other=core0

       Command: UNLOAD

       Description: Removes a core from Solr.

       Resource URL: http:// <host>:<port>/solr/admin/cores?action=UNLOAD&core=core0

Happy learning !!!

Advertisements

I am Siva Prasad Rao Janapati. Working as a software developer. Has hands on experience on ATG Commerce(DAS/DPS/DCS), Mozu commerce, Broadleaf Commerce, Java, JEE, Spring, Play, JPA, Hibernate, Velocity, JMS, Jboss, Weblogic,Tomcat, Jetty, Apache, Apache Solr, Spring Batch, JQuery, NodeJS, SOAP, REST, MySQL, Oracle, Mongo DB, Memcached, HazelCast, Git, SVN, CVS, Ant, Maven, Gradle, Amazon Web services, Rackspace, Quartz, JMeter, Junit, Open NLP, Facebook Graph,Twitter4J, YouTube Gdata, Bazzarvoice,Yotpo, 4-Tell, Alatest, Shopzilla, Linkshare. I have hands on experience on open sources and commercial technologies.

Tagged with: , , ,
Posted in Solr REST API
2 comments on “How to work with Apache Solr REST APIs?
  1. Bheemeshwar Yerra says:

    Do we have any EndPoint URL’s to Add/Update field in solr?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

DZone

DZone MVB

Java Code Geeks
Java Code Geeks
%d bloggers like this: