Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for Searchable Snapshots GA release #3462

Merged
merged 9 commits into from
Apr 11, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,26 @@ redirect_from:

# Searchable snapshots

Searchable snapshots is an experimental feature released in OpenSearch 2.4. Therefore, we do not recommend the use of this feature in a production environment. For updates on progress, follow us on [GitHub](https://github.com/opensearch-project/OpenSearch/issues/3739). If you have any feedback please [submit a new issue](https://github.com/opensearch-project/OpenSearch/issues/new/choose).
{: .warning }
A searchable snapshot index reads data from a [snapshot repository]({{site.url}}{{site.baseurl}}/opensearch/snapshots/snapshot-restore/#register-repository) on demand in real time (at search time) rather than downloading all index data to cluster storage at restore time. Because the index data remains in the snapshot format in the repository, searchable snapshot indexes are inherently read-only. Any attempt to write to a searchable snapshot index results in an error.

A searchable snapshot is an index where data is read from a [snapshot repository]({{site.url}}{{site.baseurl}}/opensearch/snapshots/snapshot-restore/#register-repository) on demand at search time rather than all index data being downloaded to cluster storage at restore time. Because the index data remains in the snapshot format in the repository, searchable snapshot indexes are inherently read-only. Any attempt to write to a searchable snapshot index will result in an error.
The searchable snapshot feature incorporates techniques like caching frequently used data segments in cluster nodes and removing the least used data segment from the cluster nodes to make space for frequently used data segments. The data segments downloaded from snapshots on block storage reside alongside the general indexes of the cluster nodes. As such, the computing capacity of cluster nodes is shared between indexing, local search, and data segments on a snapshot residing on lower-cost object storage like Amazon Simple Storage Service (Amazon S3). While cluster node resources are utilized much more efficiently, the high number of tasks results in slower and longer snapshot searches. The local storage of the node is also used for caching the snapshot data.

To enable the searchable snapshots feature, reference the following steps.
## Configuring a node to use searchable snapshots

## Enabling the feature flag

There are several methods for enabling searchable snapshots, depending on the installation type.

### Enable on a node using a tarball installation

The flag is toggled using a new jvm parameter that is set either in `OPENSEARCH_JAVA_OPTS` or in config/jvm.options:

- Option 1: Update config/jvm.options by adding the following line:

```json
-Dopensearch.experimental.feature.searchable_snapshot.enabled=true
```

- Option 2: Use the `OPENSEARCH_JAVA_OPTS` environment variable:

```json
export OPENSEARCH_JAVA_OPTS="-Dopensearch.experimental.feature.searchable_snapshot.enabled=true"
```
- Option 3: For developers using Gradle, update run.gradle by adding the following lines:

```json
testClusters {
runTask {
testDistribution = 'archive'
if (numZones > 1) numberOfZones = numZones
if (numNodes > 1) numberOfNodes = numNodes
systemProperty 'opensearch.experimental.feature.searchable_snapshot.enabled', 'true'
}
}
```

- Finally, create a node in your opensearch.yml file and define the node role as `search`:
To configure the searchable snapshots feature, create a node in your opensearch.yml file and define the node role as `search`:
ariamarble marked this conversation as resolved.
Show resolved Hide resolved

```bash
node.name: snapshots-node
node.roles: [ search ]
```

### Enable with Docker containers

If you're running Docker, add the following line to docker-compose.yml underneath the `opensearch-node` and `environment` sections:

```json
OPENSEARCH_JAVA_OPTS="-Dopensearch.experimental.feature.searchable_snapshot.enabled=true" # Enables searchable snapshot
```

To create a node with the `search` node role, add the line `- node.roles: [ search ]` to your docker-compose.yml file:
If you're running Docker, you can create a node with the `search` node role by adding the line `- node.roles: [ search ]` to your docker-compose.yml file:

```bash
version: '3'
services:
opensearch-node1:
image: opensearchproject/opensearch:2.4.0
image: opensearchproject/opensearch:2.7.0
container_name: opensearch-node1
environment:
- cluster.name=opensearch-cluster
Expand Down