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.
#### Note: If your VPS has not much memory, Elasticsearch can't be able to start. This guide also explains how to start with this case.
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.
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.