/projects-search-api

This a REST APIs application to test Ruby on Rails implementation with Elasticsearch search engine.

Primary LanguageRuby

Projects Search APIs with Elasticsearch

This a REST APIs application to test Ruby on Rails implementation with Elasticsearch search engine.

Prerequisites

The setups steps expect following tools installed on the system.

1. Check out the repository
git clone git@github.com:touredev/projects-search-api.git
2. Create .env file from .example.env and set environment variables

Copy the sample .example.env file and edit the system configuration as required.

cp .example.env .env
3. Create and setup the database

Run the following commands to create and setup the database.

rails db:create
rails db:setup
4. Import data into Elasticsearch

Run the following commands to import the data.

rails c
Project.import(force: true)
5. Start the Rails server

You can start the rails server using the command given below.

rails s
6. Test the API

You can test the search endpoint in your browser like in the example below.

GET http://localhost:3000//main/search?q=amazon

GET http://localhost:3000//main/search?q=amazon&tech_stack=python