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. 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 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 location of the specified backups.

       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 !!!

Advertisement

Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub(https://github.com/2013techsmarts) where he put the source code of his work related to his blog posts.

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dzone.com
DZone

DZone MVB

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