Data in LucidWorks 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.
API Entry Points
/api/collections: Get a list of available collection names
/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. 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. |
| 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 |
|---|---|---|
| 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 stored with the other collections in the $LWE_HOME/data/solr/cores directory, but in a directory called "socialdata".
Input
curl -H 'Content-type: application/json' -d '{"name": "social", "instance_dir":"socialdata"}'
'http://localhost:8888/api/collections'
Output
{
"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 (LucidWorks Enterprise only) 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.
Labels
Page: Activities
Page: Data Sources
Page: Batch Crawling API
Page: Fields
Page: FieldTypes
Page: JDBC Drivers
Page: Settings
Page: Collection Templates
Page: Roles
Page: Filtering Results
Page: Search Handler Components
Page: Collection Index Delete