Deploy Elasticsearch

Elasticsearch 9.5 search engine with Kibana, security on and a volume

Deploy Elasticsearch

Just deployed

Just deployed

/esdata

Deploy and Host Elasticsearch on Railway

Elasticsearch is the distributed search and analytics engine from Elastic, built on Apache Lucene. It stores JSON documents and makes them searchable in near real time through a REST API, with full-text search, aggregations, geo queries and vector (kNN) search. This template runs Elasticsearch 9.5.6 with Kibana 9.5.6 as its web UI.

About Hosting Elasticsearch

Elasticsearch runs on the JVM and keeps its indices on disk, so hosting it means giving it a persistent volume, a fixed heap size and a secure network setup. This template runs a single node (discovery.type=single-node) with its data on a Railway volume and a 1 GB heap. Security is on: every request needs the elastic user and the generated ELASTIC_PASSWORD. Railway's domain terminates HTTPS, and other services reach the node over the private network on port 9200. Kibana connects as the built-in kibana_system user, whose password the Elasticsearch service sets at every start. Kibana is optional and can be deleted after deploy.

Common Use Cases

  • Full-text and faceted search for websites, shops and documentation
  • Log, metric and event analytics, explored and charted in Kibana
  • Vector and hybrid search for RAG and recommendation features

Dependencies for Elasticsearch Hosting

  • A persistent volume for the index data (mounted at /esdata)
  • Kibana (optional) for the web UI, Dev Tools console and dashboards

Deployment Dependencies

Implementation Details

Connecting. Log in to Kibana with the username elastic and the ELASTIC_PASSWORD value from the Elasticsearch service's Variables tab. From another Railway service, use reference variables:

ELASTICSEARCH_URL=${{Elasticsearch.ELASTICSEARCH_PRIVATE_URL}}
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=${{Elasticsearch.ELASTIC_PASSWORD}}

From outside Railway, use ELASTICSEARCH_PUBLIC_URL (HTTPS, port 443):

curl -u "elastic:$ELASTIC_PASSWORD" "$ELASTICSEARCH_PUBLIC_URL/_cluster/health?pretty"

For applications, create a scoped API key in Kibana (Stack Management > API keys) instead of using the elastic superuser.

What the start command does. It writes elasticsearch.yml with single-node discovery, security on, HTTP TLS off (Railway's edge does TLS) and transport bound to localhost. It then fixes the volume's ownership and starts Elasticsearch as the image's non-root user. Anonymous requests can only read GET /_cluster/health, which Railway's health check uses. Every other request without valid credentials gets 401.

Tuning. Add an ES_JAVA_OPTS variable to change the heap (default -Xms1g -Xmx1g). Keep it at about half the memory you want the service to use. Single-node indices with replicas show as yellow, which is expected. Set "number_of_replicas": 0 on your indices to make them green.

Why Deploy Elasticsearch on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Elasticsearch on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set
S3-compatible object store, keys and public URL preset, volume kept

SuperSlowSloth
0
View Template
TimescaleDB
A PostgreSQL-based time-series database for analytics on Railway.

Rakit
1
View Template
NEW
Neo4j 2026.10 Community
Neo4j graph database with APOC, Browser, Bolt TCP proxy and a volume

My Projects
0