Managing collections

Before you can create a collection, you need to add the schemas to Solr.

Collections are managed via the Solr collections API

SSH into the European gateway:

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:

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:

{
  "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:

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:

{
  "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"}}}