Power Search

Configuring ElasticSearch

Study Tracker has an optional power search feature that is implemented with ElasticSearch. To enable this feature, you will need to connect Study Tracker with an instance of ElasticSearch version 7.10 or newer. This can be accomplished with a self-hosted instance installed on the same virtual machine as Study Tracker, or on a separate managed host, such as with Amazon's OpenSearch Service.

Running a dedicated local ElasticSearch instance

The simplest setup is to run ElasticSearch from the same instance as Study Tracker, though you need to be aware of the additional CPU, memory, and disk-space usage associated with this. Follow these directions to setup a local ElasticSearch instance that will be accessible only to Study Tracker.

First, install the ElasticSearch packages:

curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg
echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update
sudo apt-get install elasticsearch

Modify the ElasticSearch configuration to allow only connections from the same host:

echo "network.host: localhost" | sudo tee -a /etc/elasticsearch/elasticsearch.yml

Be sure to run ElasticSearch as a restartable service:

sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

Lastly, update the Study Tracker application.properties file and provide the following parameters to enable power search:

search.mode=elasticsearch
elasticsearch.host=localhost
elasticsearch.port=9200

Connecting to ElasticSearch on Amazon OpenSearch Service

If you opt for using Amazon's managed ElasticSearch instead, be sure that you select the 'ElasticSearch 7.10' option. Study Tracker does not currently support OpenSearch, but will in the future. Configure your ElasticSearch instance (be sure networking config allows communication with your EC2) and then provide the following parameters to your application.properties file:

search.mode=elasticsearch
elasticsearch.host=vpc-study-tracker-xxxxxxxxx.us-east-1.es.amazonaws.com
elasticsearch.port=443
elasticsearch.use-ssl=true
elasticsearch.username=myusername
elasticsearch.password=mypassword

Last updated