Search

Enabling power search functionality

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.

Connecting to Amazon OpenSearch Service

If you opt for using Amazon's managed OpenSearch Service, be sure that you select the latest version of OpenSearch and enable the compatibility mode option. Configure your OpenSearch instance (be sure networking config allows communication with your EC2) and then provide the following parameters to your application.properties file:

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

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

Last updated