0
我有一個Profile
類。在ES索引中我有company_type
屬性。如何增強查詢取決於ElasticSearch中的屬性值?
class Profile
...
include Tire::Model::Search
include Tire::Model::Callbacks
def to_indexed_json
{ name: self.name,
company_type: self.company.company_type
}.to_json
end
end
Tire.search('profiles') do
query do
custom_filters_score do
query { all }
filter do
filter :range, last_contact_at: { gte: 7.days.ago }
boost 1
end
score_mode :total
end
end
end.results
我想如果company_type == 'intern'
由10
查詢提振。