> ## 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 Configuration API

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>;
};

[localhost link]: http://localhost:3000/docs/4/fusion-server/reference/api/solr-configuration-api

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-server/reference/api/solr-configuration-api

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

The Solr Configuration REST API is used to access and manage the Solr configuration files stored in ZooKeeper.

To manage Solr synonym lists, use the [Synonyms Editor API](/docs/4/fusion-server/reference/api/synonyms-editor-api).

To manage Solr lists of stopwords, see [Stopwords Files](/docs/4/fusion-server/concepts/querying/apps/stopwords-files).

<LwTemplate />

## Solr Configuration Definition Properties

**Path Parameters**

| Parameter  | Description                                                                                                                             |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| collection | The collection that contains the configuration files to list or view.                                                                   |
| path       | The path to a specific file or nested child nodes. If the file is not nested, the filename can be entered without any path information. |

**Query Parameters**

| Parameter | Description                                                                                                                                                                                                                                                                                                                                                                     |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| expand    | If true, the binary content of a file will be returned base64 encoded. If this is not included, only the metadata about each node will be returned.  If you would like to see the content of the file in plain text, you can add 'Accept: text/plain' to the request header. Alternately, you can get the raw bytes by adding 'Accept: application/octet-stream' to the header. |
| recursive | If true, children of nested ZooKeeper nodes will be returned. This can be used in conjunction with the path to show only children of a specific node.                                                                                                                                                                                                                           |

The output will include a list of each file with the following information:

* **name.** The name of the file or node.
* **version.** The file or node version from ZooKeeper.
* **isDir.** If the node has children, this value will be true.
* **value.** Only returned if "expand=true" is added as a query parameter. This will be returned as the base64 encoding of the contents of the file.

If the header includes 'Accept: text/plain' or 'Accept: application/octet-stream', metadata about the file will not be returned and only the content as either plain text or raw bytes.

If recursive=true and expand=true are both used in the same request, the request may be a little slow depending on how much data is requested.

## ZooKeeper Collection Configuration Definition Properties

**Path Parameters**

| Parameter  | Description                                                           |
| ---------- | --------------------------------------------------------------------- |
| collection | The collection that contains the configuration files to list or view. |
| path       | The path to a specific file (including nested child nodes).           |

**Query Parameters**

| Parameter | Description                                                                                 |
| --------- | ------------------------------------------------------------------------------------------- |
| reload    | If true, the collection will be reloaded to make the changes available to Solr immediately. |

**Input Content**

The REST API does not restrict the type of content that can be sent to ZooKeeper, but care should be taken to make sure the format of the file remains compatible with Solr’s requirements.

As a best practice, all requests should include the Content-type in the request header.

## Examples

*Show \_rest\_managed.json for the 'docs' collection, with the base64 encoded content:*

**INPUT**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD https://FUSION_HOST:8764/api/collections/docs/solr-config/_rest_managed.json?expand=true
```

**OUTPUT**

```json wrap  theme={"dark"}
{
  "name" : "_rest_managed.json",
  "version" : 0,
  "isDir" : false,
  "value" : "eyJpbml0QXJncyI6e30sIm1hbmFnZWRMaXN0IjpbXX0NCg=="
}
```

*Get the plain text version of 'synonyms.txt':*

**INPUT**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD -H 'Accept: text/plain' https://FUSION_HOST:8764/api/collections/docs/solr-config/synonyms.txt
```

**OUTPUT**

```
GB,gib,gigabyte,gigabytes
MB,mib,megabyte,megabytes
Television, Televisions, TV, TVs
pixima => pixma
```

*Show the child nodes of 'clustering':*

**INPUT**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD https://FUSION_HOST:8764/api/collections/docs/solr-config/clustering?recursive=true
```

**OUTPUT**

```json wrap  theme={"dark"}
{
  "name" : "clustering",
  "version" : 0,
  "isDir" : true,
  "children" : [ {
    "name" : "carrot2",
    "parent" : "clustering",
    "version" : 0,
    "isDir" : true,
    "children" : [ {
      "name" : "kmeans-attributes.xml",
      "parent" : "clustering/carrot2",
      "version" : 0,
      "isDir" : false
    }, {
      "name" : "lingo-attributes.xml",
      "parent" : "clustering/carrot2",
      "version" : 0,
      "isDir" : false
    }, {
      "name" : "stc-attributes.xml",
      "parent" : "clustering/carrot2",
      "version" : 0,
      "isDir" : false
    } ]
  } ]
}
```

*Replace the contents of the existing synonyms.txt file with the contents of a file named "updated-synonyms.txt" and reload the collection:*

**INPUT**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD -X PUT -H 'Content-type: text/plain' --data-binary'@updated-synonyms.txt' https://FUSION_HOST:8764/api/collections/docs/solr-config/synonyms.txt?reload=true
```

**OUTPUT**

None.

### Change Solr configurations in Fusion 5.x using the API

Add a search component and a request handler:

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD -H "Accept: application/octet-stream" https://{host}/api/collections/collectionName/solr-config/solrconfig.xml
```
