# Script with Playground

From cloning or replacing whole indices and reindexing specific directories, to adjusting replica settings, monitoring or cancelling long-running tasks, and queuing files for processing, Playground implements each capability through intuitive shell scripts organized under the `elasticsearch/` and `redis/` directories.

To get started, set `ELASTICSEARCH_URL` and `REDIS_URL` in your environment (or add them to a `.env` file at the repo root). For a comprehensive guide to script options, directory layout, and example workflows, see the full documentation on Github:

{% embed url="<https://github.com/ICIJ/datashare-playground/>" %}

## Use playground to update index's mappings and settings

Some Datashare updates can bring some fixes and improvements on the index. The index has to be reindexed accordingly.

**1. Create a temporary empty index and specify the desired Datashare version number:**

```bash
./elasticsearch/index/create.sh <temporary_index> <ds_version_number>
```

**2. Reindex all documents (under "/" path) from the original index under a temporary one:**

This step can take some time if your index has plenty of documents.

```bash
./elasticsearch/documents/reindex.sh <original_index> <temporary_index> /
```

**3. Replace the old index by the new one:**

```bash
./elasticsearch/index/replace.sh <temporary_index> <original_index>
```

#### 4. Delete the temporary index:

```bash
./elasticsearch/index/delete.sh <temporary_index>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://icij.gitbook.io/datashare/developers/introduction-to-playground.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
