@@ -269,8 +269,8 @@ It is possible to search across multiple models with the module method:
269
269
``` ruby
270
270
Elasticsearch ::Model .search(' fox' , [Article , Comment ]).results.to_a.map(& :to_hash )
271
271
# => [
272
- # {"_index"=>"articles", "_type"=>"article", " _id"=>"1", "_score"=>0.35136628, "_source"=>...},
273
- # {"_index"=>"comments", "_type"=>"comment", " _id"=>"1", "_score"=>0.35136628, "_source"=>...}
272
+ # {"_index"=>"articles", "_id"=>"1", "_score"=>0.35136628, "_source"=>...},
273
+ # {"_index"=>"comments", "_id"=>"1", "_score"=>0.35136628, "_source"=>...}
274
274
# ]
275
275
276
276
Elasticsearch ::Model .search(' fox' , [Article , Comment ]).records.to_a
@@ -415,13 +415,11 @@ Article.__elasticsearch__.create_index! force: true
415
415
Article .__elasticsearch__ .refresh_index!
416
416
```
417
417
418
- By default, index name and document type will be inferred from your class name,
419
- you can set it explicitly, however:
418
+ By default, index name will be inferred from your class name, you can set it explicitly, however:
420
419
421
420
``` ruby
422
421
class Article
423
422
index_name " articles-#{ Rails .env} "
424
- document_type " post"
425
423
end
426
424
```
427
425
@@ -529,10 +527,10 @@ class Indexer
529
527
case operation.to_s
530
528
when /index/
531
529
record = Article .find(record_id)
532
- Client .index index: ' articles' , type: ' article ' , id: record.id, body: record.__elasticsearch__ .as_indexed_json
530
+ Client .index index: ' articles' , id: record.id, body: record.__elasticsearch__ .as_indexed_json
533
531
when /delete/
534
532
begin
535
- Client .delete index: ' articles' , type: ' article ' , id: record_id
533
+ Client .delete index: ' articles' , id: record_id
536
534
rescue Elastic ::Transport ::Transport ::Errors ::NotFound
537
535
logger.debug " Article not found, ID: #{ record_id } "
538
536
end
@@ -555,7 +553,7 @@ You'll see the job being processed in the console where you started the _Sidekiq
555
553
Indexer JID-eb7e2daf389a1e5e83697128 DEBUG: ["index", "ID: 7"]
556
554
Indexer JID-eb7e2daf389a1e5e83697128 INFO: PUT http://localhost:9200/articles/article/1 [status:200, request:0.004s, query:n/a]
557
555
Indexer JID-eb7e2daf389a1e5e83697128 DEBUG: > {"id":1,"title":"Updated", ...}
558
- Indexer JID-eb7e2daf389a1e5e83697128 DEBUG: < {"ok":true,"_index":"articles","_type":"article"," _id":"1","_version":6}
556
+ Indexer JID-eb7e2daf389a1e5e83697128 DEBUG: < {"ok":true,"_index":"articles","_id":"1","_version":6}
559
557
Indexer JID-eb7e2daf389a1e5e83697128 INFO: done: 0.006 sec
560
558
```
561
559
0 commit comments