brewster / elastictastic

Object-document mapper and lightweight API adapter for ElasticSearch
MIT License
88 stars 13 forks source link

Support delete-by-query #15

Open outoftime opened 12 years ago

outoftime commented 12 years ago

E.g.:

Post.query { constant_score { term(:author_id => 1) }}.delete_all

Not clear how this should work with queries vs. filters etc...

kostia commented 11 years ago

+1

Ist there an update_all equivalent?

outoftime commented 11 years ago

Sort of -- there's the ::update_each method, which updates each document matching the scope it's called on in a concurrency-safe way. It still performs one write operation per document, since ElasticSearch doesn't have anything equivalent to an UPDATE...WHERE ? IN ? statement. Of course you can make that a bit more efficient by doing it in a bulk block.