Apache Solr Documentation

6.5 Ref Guide (PDF Download)
Solr Tutorial
Solr Community Wiki

Older Versions of this Guide (PDF)

Ref Guide Topics

Meta-Documentation

*** As of June 2017, the latest Solr Ref Guide is located at https://lucene.apache.org/solr/guide ***

Please note comments on these pages have now been disabled for all users.

Skip to end of metadata
Go to start of metadata

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. Specifying the collection/core name is mandatory. The '-help' (or simply '-h') option will output information on its usage (i.e., bin/post -help).

Using the bin/post Tool

Specifying either the collection/core name or the full update url is mandatory when using bin/post.

The basic usage of bin/post is:

Examples

There are several ways to use bin/post.  This section presents several examples.

Indexing XML

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.

Indexing CSV

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.

Indexing JSON

Index all JSON files into gettingstarted.

Indexing Rich Documents (PDF, Word, HTML, etc)

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.

Indexing to a password protected Solr (basic auth)

Index a pdf as the user solr with password SolrRocks:

Windows Support

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.

SimplePostTool

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.  

 

 

  • No labels

11 Comments

  1. Window users may use the following command to use the post replacement to continue with the Solr tutorial:

    java -Dc=gettingstarted -Dauto=yes -Ddata=files -Drecursive=yes -jar example/exampledocs/post.jar docs/

    1. Maynak - you are the only reason I haven't (yet) tossed Solr away out of frustration. Thank you.

  2. when I use the following command in my cmd:

    C:\Users\Desktop\solr-6.2.1\bin>java -Dc=wiki3 -Dauto=yes -Ddata=files -Drecursive=yes -jar example/exampledocs/post.jar docs/

    I am using windows, wiki3 is my core and I am using 6.2.1 version.

    My core is in server/solr folder, whenever I used this command or the above given solutions, everytime it shows unable to access jarfile.

    Please help. 

    Even when I tried to index from the GUI, it shows indexing complete, but document=0

    1. You really need to take this to the mailing list.  These comments are for the documentation, not for support requests.  If the following does not help, please go to the mailing list.  Alternatively, you can join the IRC channel.  Both are very easy to locate with Google.

      It's telling you it can't access the jar because you are in the "bin" directory, and there is no example directory in the bin directory, which means that "example/exampledocs/post.jar" is not there.  Try changing directories one level up.

      1. But to start solr I have to go to the bin directory, after starting solr, I changed to example directory then it show unspecified path. The same thing I tried using solr admin also, it doesn't show any data.

        1. Please take this to the mailing list or IRC channel.

  3. For all of you looking for a bin/post.cmd for Windows, please see (and contribute to)  SOLR-6994 - Implement Windows version of bin/post Open  (smile) 

  4. I am trying to use the newish web crawl functionality in the post tool. However looking around it seems it is very rudimentary.

    I do not have a lot of sites to crawl, but This would be something that we would us in our production environment. I want to know if there is a fuller web crawler that works with version 6.x of solr?

    Nutch seems to be restricted to 4.x.

    thanks for any help

  5. This tool unfortunately only supports basic authentication. Any plans to support the Kerberos authentication plugin?

    1. I'd recommend filing a JIRA issue for this request, as I looked and didn't see one already. If you can make a patch with a proposed solution, that will increase the chances of getting it into a future release.

  6. Hi,

     

    I have a issue,

    I have solr 6.5 and having 68 documents each with 58,00000 records.

    and in each file i have 5 fields.

    I want to upload only one field from 5 fields.

     

    Can anyone guide me on this?