examples/mongoid_article.rb in elasticsearch-model-0.1.7 vs examples/mongoid_article.rb in elasticsearch-model-0.1.8
- old
+ new
@@ -19,11 +19,11 @@
Mongoid.logger.level = Logger::DEBUG
Moped.logger.level = Logger::DEBUG
Mongoid.connect_to 'articles'
-Elasticsearch::Model.client = Elasticsearch::Client.new host: 'localhost:9250', log: true
+Elasticsearch::Model.client = Elasticsearch::Client.new host: 'localhost:9200', log: true
class Article
include Mongoid::Document
field :id, type: String
field :title, type: String
@@ -47,10 +47,10 @@
Article.create id: '2', title: 'Bar'
Article.create id: '3', title: 'Foo Foo'
# Index data
#
-client = Elasticsearch::Client.new host:'localhost:9250', log:true
+client = Elasticsearch::Client.new host:'localhost:9200', log:true
client.indices.delete index: 'articles' rescue nil
client.bulk index: 'articles',
type: 'article',
body: Article.all.map { |a| { index: { _id: a.id, data: a.attributes } } },