11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When using the blob store, note that the API does not delete or overwrite a previous object if a new one is<br />

uploaded with the same name. It always adds a new version of the blob to the index. Deletes can be performed<br />

with standard REST delete commands.<br />

The blob store is only available when running in <strong>Solr</strong>Cloud mode. <strong>Solr</strong> in standalone mode does not support<br />

use of a blob store.<br />

The blob store API is implemented as a requestHandler. A special collection named ".system" must be created<br />

as the collection that contains the blob store index.<br />

Create a .system Collection<br />

Before using the blob store, a special collection must be created and it must be named .system.<br />

The BlobHandler is automatically registered in the .system collection. The solrconfig.xml, Schema, and<br />

other configuration files for the collection are automatically provided by the system and don't need to be defined<br />

specifically.<br />

If you do not use the -shards or -replicationFactor options, then defaults of 1 shard and 1 replica will be<br />

used.<br />

You can create the .system collection with the Collections API, as in this example:<br />

curl<br />

"http://localhost:8983/solr/admin/collections?action=CREATE&name=.system&replication<br />

Factor=2"<br />

Note that the bin/solr script cannot be used to create the .system collection at this time. Also, please<br />

ensure that there is at least one collection created before creating the .system collection.<br />

Upload Files to Blob Store<br />

After the .system collection has been created, files can be uploaded to the blob store with a request similar to<br />

the following:<br />

curl -X POST -H 'Content-Type: application/octet-stream' --data-binary @{filename}<br />

http://localhost:8983/solr/.system/blob/{blobname}<br />

For example, to upload a file named "test1.jar" as a blob named "test", you would make a POST request like:<br />

curl -X POST -H 'Content-Type: application/octet-stream' --data-binary @test1.jar<br />

http://localhost:8983/solr/.system/blob/test<br />

A GET request will return the list of blobs and other details:<br />

curl http://localhost:8983/solr/.system/blob?omitHeader=true<br />

Output:<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

480

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!