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

# Apache Solr

This is the implementation of the Solr data handler for MindsDB.

[Apache Solr](https://solr.apache.org/) is a highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration, and more.

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB locally via [Docker](/setup/self-hosted/docker) or [Docker Desktop](/setup/self-hosted/docker-desktop).
2. To connect Apache Solr to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to Apache Solr.

## Implementation

This handler is implemented using the `sqlalchemy-solr` library, which provides a Python/SQLAlchemy interface.

The required arguments to establish a connection are as follows:

* `username` is the username used to authenticate with the Solr server. This parameter is optional.
* `password` is the password to authenticate the user with the Solr server. This parameter is optional.
* `host` is the host name or IP address of the Solr server.
* `port` is the port number of the Solr server.
* `server_path` defaults to `solr` if not provided.
* `collection` is the Solr Collection name.
* `use_ssl` defaults to `false` if not provided.

<Tip>
  Further reference: [https://pypi.org/project/sqlalchemy-solr/](https://pypi.org/project/sqlalchemy-solr/).
</Tip>

## Usage

In order to make use of this handler and connect to the Solr database in MindsDB, the following syntax can be used:

```sql theme={null}
CREATE DATABASE solr_datasource
WITH
    engine = 'solr',
    parameters = {
      "username": "demo_user",
      "password": "demo_password",
      "host": "127.0.0.1",
      "port": "8981",
      "server_path": "solr",
      "collection": "gettingstarted",
      "use_ssl": "false"
    };
```

You can use this established connection to query your table as follows:

```sql theme={null}
SELECT *
FROM solr_datasource.gettingstarted
LIMIT 10000;
```

<Info>
  **Requirements**

  A Solr instance with a Parallel SQL supported up and running.

  There are certain limitations that need to be taken into account when issuing queries to Solr. Refer to [https://solr.apache.org/guide/solr/latest/query-guide/sql-query.html#parallel-sql-queries](https://solr.apache.org/guide/solr/latest/query-guide/sql-query.html#parallel-sql-queries).
</Info>

<Tip>
  Don't forget to put limit in the end of the SQL statement
</Tip>
