> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Solr collections

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[old doc.lw link]: https//doc.lucidworks.com/fusion/5.9/011kpa

[localhost link]: http://localhost:3000/docs/5/fusion/operations/config-sync/objects/solr-collections

[mintlify link]: https://doc.lucidworks.com/docs/5/fusion/operations/config-sync/objects/solr-collections

ConfigSync offers a streamlined way to handle Solr collections directly from your repository.
Here’s a practical guide on creating, modifying, and potentially deleting Solr collections through ConfigSync.

<LwTemplate />

## Configuration storage

Store your Solr collection configurations in the `_lw_system/solr-collections` directory within your repository.

## Creating Solr collections

### Format

The JSON file for a Solr collection should follow the Solr V2 API format as detailed in the [Solr Guide for Collection Management](https://solr.apache.org/guide/solr/latest/deployment-guide/collection-management.html#create).

### Example

Here’s a sample JSON configuration for creating a Solr collection with an alias:

```json wrap  theme={"dark"}
{
  "pullReplicas" : "0",
  "replicationFactor" : "1",
  "router" : {
    "name" : "compositeId"
  },
  "maxShardsPerNode" : "1",
  "autoAddReplicas" : "false",
  "nrtReplicas" : "1",
  "tlogReplicas" : "0",
  "name" : "collection_live",
  "numShards" : 1,
  "alias" : "solr_collection_b",
  "config" : "RH"
}
```

### Alias creation

If an alias is specified in the JSON, ConfigSync also creates this alias alongside the collection.

<Warning>
  An alias cannot have the same name as an existing collection. Ensure your alias name is unique and does not match any collection name.
</Warning>

## Modifying Solr collections

### Modification constraints

While it’s possible to modify the Solr collection JSON file, only certain properties can be changed as per the [Solr Guide for Modifying Collections](https://solr.apache.org/guide/solr/latest/deployment-guide/collection-management.html#modifycollection).

### Properties you can modify

These include `alias`, `config`, `replicationFactor`, `maxShardsPerNode`, `readOnly`, `perReplicaState`, and `autoAddReplicas`.

### Alias modification/deletion

Modifying the collection configuration can also modify or delete an existing alias, if specified.

## Deleting Solr collections

### Safety first

By default, ConfigSync is designed not to delete Solr collections to prevent accidental data loss.

### Force deletion

If you’re certain about your action, you can force delete a Solr collection by prefixing your commit message with `force:<MESSAGE>` when you remove collection files from the repo.
This action can also remove any specified alias.
