Elasticsearch is an open source distributed, RESTful search and analytics engine, scalable data store, and vector database capable of addressing a growing number of use cases.
This add-on integrates Elasticsearch into your DDEV project.
ddev add-on get ddev/ddev-elasticsearch
ddev restart
After installation, make sure to commit the .ddev
directory to version control.
ddev add-on get ddev/ddev-elasticsearch
cp .ddev/elasticsearch/docker-compose.elasticsearch8.yaml .ddev/
ddev restart
All Elasticsearch data is stored in a Docker volume, so if you’re switching versions or setups, you may want to start fresh by removing the volume:
# remove old elasticsearch volume (if this is downgrade)
ddev stop
docker volume rm ddev-$(ddev status -j | docker run -i --rm ddev/ddev-utilities jq -r '.raw.name')_elasticsearch
To access the Elasticsearch container from within the web container, use the hostname elasticsearch
and port 9200
. For example, the server URL might be http://elasticsearch:9200
. Alternatively, you can use the ddev.site
URLs to access it via HTTP or HTTPS: http://<projectname>.ddev.site:9200
and https://<projectname>.ddev.site:9201
. These URLs are also available from the host.
Tip
What about Kibana support? Use this add-on.
Avoid modifying the provided docker-compose.elasticsearch.yaml
file. Instead, create a docker-compose.elasticsearch_extras.yaml
file for any customizations. For more information on defining additional services with Docker Compose, please refer to the official DDEV documentation.
To change the minor version of Elasticsearch:
ddev dotenv set .ddev/.env.elasticsearch --elasticsearch-docker-image=elasticsearch:7.17.14
ddev restart
Make sure to commit the .ddev/.env.elasticsearch
file to version control.
By default, this configuration limits the memory usage of the elasticsearch
service to 512MB. This should be sufficient for most projects. However, if the service stops unexpectedly, you may need to increase the maximum memory allocation for Docker and/or the elasticsearch
service. To do so, modify the ES_JAVA_OPTS
environment variable in the docker-compose.elasticsearch_extras.yaml
file.
Example for 2GB:
services:
elasticsearch:
environment:
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
You can use ddev logs -s elasticsearch
to investigate the Elasticsearch daemon’s activity or to troubleshoot RAM-related crashes.
Originally Contributed by dacostafilipe with contributions by @Morgy93, @amitaibu, @aronnovak and others
Maintained by @aronnovak