- Install Docker
- Install Docker Compose
-
Create a new docker-compose.yml using the following lines
version: '2' services: elasticsearch: image: elasticsearch:7.14.1 container_name: eeag_elasticsearch environment: - discovery.type=single-node - "ES_JAVA_OPTS=-Xms256m -Xmx256m" volumes: - elasticsearch_data:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - elastic restart: "always" volumes: elasticsearch_data: networks: elastic:
-
Install and start ES service:
docker-compuse up -d
-
Check if you get a response when hit localhost:9200:, if you get a response, that means ES is running.
-
Install the requirements or check if you have the latest version of django-haystack
pip install -r requirements.dev.txt
OR
pip install django-haystack -U
- Replace HAYSTACK_CONNECTIONS settings in localsettings.py:
HAYSTACK_CONNECTIONS = {
"default": {
"ENGINE": "haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine",
"URL": "http://localhost:9200/",
"INDEX_NAME": "eeagrants",
"BATCH_SIZE": 999,
"SILENTLY_FAIL": False,
},
}
- Rebuild index using the following command
./manage.py rebuild_index