Managing collections ==================== Before you can create a collection, you need to `add the schemas `_ to Solr. Collections are managed via the `Solr collections API`_ .. _Solr collections API: https://cwiki.apache.org/confluence/display/solr/Collections+API SSH into the European gateway: .. code-block:: bash ssh -l root 54.229.115.35 Delete existing collections --------------------------- Collections can be deleted by calling the DELETE action and providing the name of the collection to be deleted. To delete the listings and categories collections: .. code-block:: bash curl "http://internal-solr-eu-208802902.eu-west-1.elb.amazonaws.com:8983/solr/admin/collections?action=DELETE&name=listings&wt=json&indent=true" curl "http://internal-solr-eu-208802902.eu-west-1.elb.amazonaws.com:8983/solr/admin/collections?action=DELETE&name=categories&wt=json&indent=true" A successful delete will display a result similar to: .. code-block:: javascript { "responseHeader":{ "status":0, "QTime":863}, "success":{ "10.0.52.137:8983_solr":{ "responseHeader":{ "status":0, "QTime":15}}, "10.0.51.66:8983_solr":{ "responseHeader":{ "status":0, "QTime":19}}, "10.0.51.198:8983_solr":{ "responseHeader":{ "status":0, "QTime":19}}, "10.0.53.127:8983_solr":{ "responseHeader":{ "status":0, "QTime":21}}}} Create new collections ---------------------- Collections are created by calling the CREATE action with the following params: =================== ======================= name listings | categories numShards 2 replicationFactor 2 maxShardsPerNode 2 =================== ======================= To create the listings and categories collections: .. code-block:: bash curl "http://internal-solr-eu-208802902.eu-west-1.elb.amazonaws.com:8983/solr/admin/collections?action=CREATE&name=listings&numShards=2&replicationFactor=2&maxShardsPerNode=2&wt=json&indent=true" curl "http://internal-solr-eu-208802902.eu-west-1.elb.amazonaws.com:8983/solr/admin/collections?action=CREATE&name=categories&numShards=2&replicationFactor=2&maxShardsPerNode=2&wt=json&indent=true" On success will show a result similar to: .. code-block:: bash { "responseHeader":{ "status":0, "QTime":3592}, "success":{ "":{ "responseHeader":{ "status":0, "QTime":1882}, "core":"listings_shard1_replica2"}, "":{ "responseHeader":{ "status":0, "QTime":2341}, "core":"listings_shard1_replica1"}, "":{ "responseHeader":{ "status":0, "QTime":2661}, "core":"listings_shard2_replica1"}, "":{ "responseHeader":{ "status":0, "QTime":2859}, "core":"listings_shard2_replica2"}}}