Module: ElasticRecord::PercolatorModel::ClassMethods
- Defined in:
- lib/elastic_record/percolator_model.rb
Constant Summary collapse
- DEFAULT_PERCOLATOR_MAPPING =
{ properties: { query: { type: 'percolator' } } }
Instance Method Summary collapse
Instance Method Details
#elastic_index ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elastic_record/percolator_model.rb', line 18 def elastic_index @elastic_index ||= begin index = ElasticRecord::Index.new(self) index.mapping = DEFAULT_PERCOLATOR_MAPPING index.mapping = percolates_model.elastic_index.mapping index.settings = percolates_model.elastic_index.settings index.partial_updates = false index end end |
#percolate(document) ⇒ Object
29 30 31 32 33 |
# File 'lib/elastic_record/percolator_model.rb', line 29 def percolate(document) query = Arelastic::Queries::Percolate.new("query", document) elastic_search.filter(query).limit(5000) end |