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.

{<br />

"responseHeader":{<br />

"status":0,<br />

"QTime":2041},<br />

"cluster":{<br />

"collections":{<br />

"mycollection":{<br />

"shards":{<br />

"shard1":{<br />

"range":"80000000-ffffffff",<br />

"state":"active",<br />

"replicas":{"core_node1":{<br />

"state":"active",<br />

"base_url":"https://127.0.0.1:8984/solr",<br />

"core":"mycollection_shard1_replica1",<br />

"node_name":"127.0.0.1:8984_solr",<br />

"leader":"true"}}},<br />

"shard2":{<br />

"range":"0-7fffffff",<br />

"state":"active",<br />

"replicas":{"core_node2":{<br />

"state":"active",<br />

"base_url":"https://127.0.0.1:7574/solr",<br />

"core":"mycollection_shard2_replica1",<br />

"node_name":"127.0.0.1:7574_solr",<br />

"leader":"true"}}}},<br />

"maxShardsPerNode":"1",<br />

"router":{"name":"compositeId"},<br />

"replicationFactor":"1"}},<br />

"properties":{"urlScheme":"https"}}}<br />

Index documents using post.jar<br />

Use post.jar to index some example documents to the <strong>Solr</strong>Cloud collection created above:<br />

cd example/exampledocs<br />

java -Djavax.net.ssl.keyStorePassword=secret<br />

-Djavax.net.ssl.keyStore=../../server/etc/solr-ssl.keystore.jks<br />

-Djavax.net.ssl.trustStore=../../server/etc/solr-ssl.keystore.jks<br />

-Djavax.net.ssl.trustStorePassword=secret<br />

-Durl=https://localhost:8984/solr/mycollection/update -jar post.jar *.xml<br />

Query using cURL<br />

Use cURL to query the <strong>Solr</strong>Cloud collection created above, from a directory containing the PEM formatted<br />

certificate and key created above (e.g. example/etc/ ) - if you have not enabled client authentication (system<br />

property -Djetty.ssl.clientAuth=true), then you can remove the -E solr-ssl.pem:secret option:<br />

curl -E solr-ssl.pem:secret --cacert solr-ssl.pem<br />

"https://localhost:8984/solr/mycollection/select?q=*:*&wt=json&indent=on"<br />

Index a document using Cloud<strong>Solr</strong>Client<br />

From a java client using <strong>Solr</strong>j, index a document. In the code below, the javax.net.ssl.* system properties<br />

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

531

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

Saved successfully!

Ooh no, something went wrong!