Solr includes a simple command line tool for POSTing various types of content to a Solr server. The tool is bin/post
. The bin/post tool is a Unix shell script; for Windows (non-Cygwin) usage, see the Windows section below.
To run it, open a window and enter:
This will contact the server at localhost:8983. S
pecifying the collection/core name
is mandatory. The '-help' (or simply '-h' option will output information on its usage (i.e., bin/post -help)
.
Specifying either the collection/core name
or the full update url
is mandatory when using bin/post
.
The basic usage of bin/post
is:
There are several ways to use bin/post
. This section presents several examples.
Add all documents with file extension .xml
to collection or core named gettingstarted
.
Add all documents with file extension .xml
to the gettingstarted
collection/core on Solr running on port 8984
.
Send XML arguments to delete a document from gettingstarted
.
Index all CSV files into gettingstarted
:
Index a tab-separated file into gettingstarted
:
The content type (-type
) parameter is required to treat the file as the proper type, otherwise it will be ignored and a WARNING logged as it does not know what type of content a .tsv file is. The CSV handler supports the separator
parameter, and is passed through using the -params
setting.
Index all JSON files into gettingstarted
.
Index a PDF file into gettingstarted
.
Automatically detect content types in a folder, and recursively scan it for documents for indexing into gettingstarted
.
Automatically detect content types in a folder, but limit it to PPT and HTML files and index into gettingstarted
.
bin/post
exists currently only as a Unix shell script, however it delegates its work to a cross-platform capable Java program. The SimplePostTool
can be run directly in supported environments, including Windows.
The bin/post
script currently delegates to a standalone Java program called SimplePostTool
. This tool, bundled into a executable JAR, can be run directly using java -jar example/exampledocs/post.jar. See the help output and take it from there to post files, recurse a website or file system folder, or send direct commands to a Solr server.