Skip to content

Conversation

dbackeus
Copy link
Contributor

@dbackeus dbackeus commented May 2, 2023

Why

The goal of the rails-example application is to serve as an example web application for learning how to deploy apps to the Reclaim the Stack platform. Currently it uses Postgres and Redis but since the platform also supports Elasticsearch we want the demo application to use this as well.

What

Indexes the Post and Link models into a searchable Elasticsearch index to allow for doing full text search across both models. Each document in the index will use a title field with a high priority and a content field with lower priority (taken from Post#body and Link#description respectively).

This implementation uses Net::HTTP to interact with Elasticsearch, without involving any extra dependencies.

Feel free to compare with #2 which is based on elasticsearch-rails.

Lines of Code

Implementation: ~200 LOC
Dependencies: 0 LOC

Time spent

Didn't keep track but approximately 2 hours.

Issues

None

Learnings

I learnt a few things about the Elasticsearch API which will come in handy when working with and debugging Elasticsearch in the future. I also learnt how to use Net::HTTP directly, which though not as streamlined as alternative HTTP clients, isn't the end of the world.

@dbackeus dbackeus changed the title DIY search Elasticsearch with 0 dependencies May 2, 2023
@dbackeus dbackeus changed the base branch from master to before-elastic May 2, 2023 14:58
@dbackeus dbackeus changed the title Elasticsearch with 0 dependencies Add Elasticsearch without external dependencies May 3, 2023
@gunnars04
Copy link

I would 100% go for without external dependencies. Not everybody is using ruby on rails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants