The following guide explains how to use [Elasticsearch](https://www.elastic.co/products/elasticsearch).
Why you might need Elasticsearch
----
If you want to use Full-text search, you should setup Elasticsearch.
Installing Pre-required dependency
----
Elasticsearch is built using Java, and requires at least Java 8 in order to run.
Install Java 8:
```
sudo apt install openjdk-8-jre
```
> The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
***Note: If your VPS has insufficient memory, Elasticsearch may not be able to start. See the Advanced Configuration section at the end of this document for some options if this is the case.***
### Configuring Mastodon for Elasticsearch
Change Elasticsearch configuration in `.env.production` to:
This guide may be useful if you can't start Elasticsearch, or if Elasticsearch uses too much memory.
First, Elasticsearch needs a lot of memory.
You should check [this page](https://www.elastic.co/guide/en/elasticsearch/guide/current/hardware.html).
But, as far as I can recollect, Mastodon does not require much memory for Elasticsearch.
When building Elasticsearch server on low memory VPS, It's necessary to change the configuration.
Change these lines in `/etc/elasticsearch/jvm.options`:
```
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1g
-Xmx1g
```
#### Note: Are you worried about how much memory configuration need on your VPS? This list may be useful! In my opinion, It would be better to set it from 35% to 50% of the total memory.
To configure your remote server, see the [Elasticsearch documentation on network settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html).