SolrClient.Collections module

Solr Collections api interface.

class SolrClient.Collections(solr, log)

Provides an interface to Solr Collections API.

api(action, args=None)

Sends a request to Solr Collections API. Documentation is here: https://cwiki.apache.org/confluence/display/solr/Collections+API

Parameters:
  • action (string) – Name of the collection for the action
  • args (dict) – Dictionary of specific parameters for action
check_status(ignore=(), status=None)
Checks status of each collection and shard to make sure that:
  1. Cluster state is active
  2. Number of docs matches across replicas for a given shard.

Returns a dict of results for custom alerting.

cluster_status_raw(**kwargs)

Returns raw output of the clusterstatus api command.

clusterstatus()

Returns a slightly slimmed down version of the clusterstatus api command. It also gets count of documents in each shard on each replica and returns it as doc_count key for each replica.

create(name, numShards, params=None)

Create a new collection.

exists(collection)

Return True if a collection exists.

list()

Returns a list[string] of all collection names on the cluster.