Data in LucidWorks Search is organized into Collections. A collection contains data that is logically distinct from data in other collections. Collections have their own Data Sources, Settings, Fields, and Role Mappings. In other words, collections are distinct except that they happen to run in the same instance of LucidWorks Search.
For more information about collections, see also Working with Collections.
API Entry Points
/api/collections: list collections or create a new collection
/api/collections/collection: Get details or remove a collection
List Collection Names
GET /api/collections
Input
Path Parameters
None
Query Parameters
None
Output
Output Content
A JSON List of Maps mapping Collection keys to values.
| Key | Type | Description |
|---|---|---|
| name | string | The name of the collection. |
| instance_dir | string | Advanced: <filepath>. Displays the directory name of the collection in $LWE_HOME/data/solr/cores. |
Response Codes
200: success ok
Examples
Get a list of all collections and their locations:
Input
curl http://localhost:8888/api/collections
Output
[
{
"name": "new_collection",
"instance_dir": "new_collection_1"
},
{
"name": "collection 1",
"instance_dir": "collection1_0"
},
{
"name": "social",
"instance_dir": "socialdata"
}
]
Create Collection
POST /api/collections
Input
Path Parameters
None
Query Parameters
None
Input content
JSON block with all keys.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | null | The name of the collection. |
| template | string | No | None | The name of the collection template to use while creating the collection. To use the default set of LucidWorks configuration files, enter default.zip. See Using Collection Templates for more information on how to create and use collection templates. |
| instance_dir | string | No | None | Advanced: <filepath> Allows you to optionally override the name and/or location of the Solr instance directory for the collection. By default, this will be the next available collection n directory in $LWE_HOME/data/solr/cores. File paths that are not absolute will be relative to $LWE_HOME/data/solr/cores. |
| num_shards | integer | No | None | Used only when running in SolrCloud mode, this attribute is used to specify the number of shards to split the index to after the collection is created. This will register the new collection and its configuration files with ZooKeeper, and share the configurations with the other shards. This number should match the number of shards running to avoid errors, but it is possible to create a collection and start more shards later. |
| Because collection templates are based on an instance_dir, it's recommended to specify either parameter when creating a new collection, not both. |
Output
Output Content
JSON representation of new collection
| Key | Type | Description |
|---|---|---|
| instance_dir | string | The name of the directory that was created under $LWE_HOME/conf/solr/cores that contains the configuration files. |
| name | string | The name of the collection. |
Return Codes
201: created
Examples
Create a new collection called "social" and specify that the collection should be split across two shards of a SolrCloud cluster.
Input
curl -H 'Content-type: application/json' -d '{"name":"social","num_shards":2,"template":"default.zip"}'
http://localhost:8888/api/collections
Output
{
"instance_dir": "social_1",
"name": "social"
}
List Information for Specific Collection
GET /api/collections/collection
Input
Path Parameters
| Key | Description |
|---|---|
| collection | The collection name. |
Query Parameters
None
Output
Output Content
JSON representation of the collection.
| Key | Type | Description |
|---|---|---|
| name | string | The name of the collection. |
| instance_dir | string | The collection directory name relative to $LWE_HOME/solr/cores. |
Response Codes
200: success ok
Examples
Get the collection information for the "social" collection:
Input
curl http://localhost:8888/api/collections/social
Output
{
"name":"social",
"instance_dir":"socialdata"
}
Delete Collection
DELETE /api/collections/collection
| To delete the index for a collection without deleting the entire collection, see the Collection Index Delete API. |
Deleting a collection will delete all associated indexes and settings, but not alerts or manually created users. Use the Alerts API or the Users API to delete those.
Input
Path Parameters
| Key | Description |
|---|---|
| collection | The collection name. |
Query Parameters
None
Input content
None
Output
Output Content
None
Return Codes
204: success no content
404: not found
Examples
Delete the "social" collection:
Input
curl -X DELETE http://localhost:8888/api/collections/social
Output
None.
Related Topics
Labels
Page: Collection Templates
Page: Collection Index Delete
Page: Activities
Page: Data Sources
Page: Data Source Schedules
Page: Data Source Jobs
Page: Data Source Status
Page: Data Source History
Page: Data Source Crawl Data Delete
Page: Batch Operations
Page: JDBC Drivers
Page: FieldTypes
Page: Fields
Page: Dynamic Fields
Page: Filtering Results
Page: Search Components
Page: Settings
Page: Caches
Page: Click Scoring
Page: Roles