From 8952f5f99cc91291cfeca2b97bc76c0bd6a65323 Mon Sep 17 00:00:00 2001 From: anandvc Date: Wed, 24 Jan 2018 00:20:15 -0800 Subject: [PATCH 1/2] Updated README.MD Include the step to create the index for the model that we'll import. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f7c8e1151..7bfcb7703 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ class Article < ActiveRecord::Base include Elasticsearch::Model::Callbacks end +Article.__elasticsearch__.create_index! Article.import @articles = Article.search('foobar').records From 55d997b9722e2ae536deb664d04d0fdd3d3e581d Mon Sep 17 00:00:00 2001 From: anandvc Date: Thu, 30 May 2019 14:51:15 -0700 Subject: [PATCH 2/2] Commented to encourage asynchronous index creation I've added a comment so that users are encouraged to do `create_index!` asynchronously and not at the same time as `import`. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7bfcb7703..7887f8a92 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,9 @@ class Article < ActiveRecord::Base include Elasticsearch::Model::Callbacks end +# Index creation right at import time is not encouraged. +# Typically, you would call create_index! asynchronously (e.g. in a cron job) +# However, we are adding it here so that this usage example can run correctly. Article.__elasticsearch__.create_index! Article.import