Create a Collection

Create a collection in a Solr cluster in Lucidworks Managed Search.

Note
This topic describes how to create a collection in Managed Search using the API. For instructions using the UI, see Manage Collections in Managed Search UI.

Request

Send an HTTP request with these elements.

Element Description

Method

POST

Endpoint

customers/customerId/clusters/clusterId/collections

Request header fields

Request header fields specify metadata for the request. For example, the Authorization header contains the OAuth2 access token.

Message body

Attributes for creating a collection

These attributes are required when creating a collection in a Solr cluster.

Attribute Type Required? Description

autoscaling

Boolean

no

Boolean property (true or false) that indicates whether to enable autoscaling for this collection. Autoscaling properties are specified at the cluster level.

name

string

yes

Meaningful name for the collection that is unique within the cluster. You can change the name of a collection after it is created.

nearRealTimeReplicas

integer

yes

Number of NRT (NearRealTime) replicas per shard. An NRT replica writes new documents to its indexes locally. Any replica of this type is eligible to become a leader.

numShards

integer

yes

Number of shards

readOnlyReplicas

integer

yes

Number of PULL replicas per shard. This type of replica doesn’t index document changes locally. It only replicates the index from the shard leader. It is not eligible to become a shard leader.

readWriteRepicas

integer

yes

Number of TLOG replicas per shard. This type of replica doesn’t index document changes locally. This type of replica helps to speed up indexing, because no commits need to occur in the replicas. This type of replica is also eligible to become a shard leader.

refreshInterval

integer

yes

Interval in milliseconds for refreshing the collection to reflect the latest updates and documents. At the Solr configuration level, the autoSolrCommit - maxTime property is updated. The interval can’t be less than 5000 milliseconds (5 seconds). The default is 10000 milliseconds (10 seconds).

Response

A response from a request to create a Solr cluster contains these elements.

Element Description

Status line

The status line contains the status code and the reason phrase.

Response header fields

Response header fields specify information about the response.

Message body

JSON object that specifies the taskId and the status of the request.

Example

Request:

curl "https://pg01.us-west1.cloud.lucidworks.com/managed/api/customers/lucidworks/clusters/jeff-1/collections" -H "Content-Type: application/json" -H "Authorization: Bearer accessTokenManagedSearch" -d '{"autoscaling": false, "name": "test-collection", "numShards": 1, "nearRealTimeReplicas": 1, "readOnlyReplicas": 0, "readWriteReplicas": 0}'

The POST method is implicit.

Response:

Element Example

Status line

HTTP/1.1 200 Success

Response header fields

Response header fields specify metadata about the response.

Message body

See immediately below.

Message body:

{
  "attributes": {
    "autoscaling": true,
    "name": "string",
    "nearRealTimeReplicas": 0,
    "numShards": 0,
    "readOnlyReplicas": 0,
    "readWriteReplicas": 0,
    "refreshInterval": 0
  },
  "clusterId": "string",
  "customerId": "string"
}