Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

pdcoutinho/elastest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elastest

Elastic search test with relational models

This dummy project uses the gem elasticsearch-rails.

The only requirement for installing Elasticsearch is a recent version of Java. Preferably, you should install the latest version of the official Java from www.java.com.

Then, follow the steps on the official guide to install Elasticsearch.

Prepare the database and then run

$ rake db:seed

to populate the database.

The seeds.rb file can be altered to change the number of records:

# sets number of articles to create
article_count = 20000

# sets number of users to create
user_count = 30

# sets number of comments per article
comment_count_per_article = 3

Run the commands to drop/create the Article index.

Note: On this project only the Article model is enabled for indexing

# drops Article index
$ rake elastest:drop_index[model_name]

# creates article indices
$ rake elastest:create_indices[model_name]

# creates Article index
$ rake elastest:create_index[model_name]

# runs all the tasks
$ rake elastest:all[model_name]

Elastic search is accessible at http://localhost:9200/articles/article/1 (will show first article).

Rails version is at http://localhost:3000/search.

Usefull links for elastic:

# shows statistics
http://localhost:9200/_stats

# shows the mappings
http://localhost:9200/articles/article/_mapping

Aditional information can be found here on this cheat sheet

About

Elastic search test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published