Solr, by default, includes a post script for indexing various kinds of documents directly to the Solr server. This utility is very helpful when you have huge files present and you want to end up writing a program that reads each line and then sends it to the Solr server via HTTP end points.
The following screenshot helps us to understand how we can execute a post script from the command line:
This table consists of some example commands used for the same purpose:
Command
|
Description
|
post -c chintan *.xml |
This adds all files with extension .xml to the core or collection named chintan |
post -c chintan -d '<delete><id>42</id></delete>' |
Deletes a document from the chintan collection or core that has ID 42 |
post -c chintan *.csv |
Indexes all CSV files with auto field mappings on |
post -c chintan *.json |
Indexed all JSON files |
post -c chintan *.pdf |
Indexes all PDF files |
post -c chintan abc/ |
Indexes all files inside the abc folder |
post -c chintan -filetypes ppt,html abc/ |
Indexes only PPT and HTML files inside the abc folder |