0
class Doctor < ActiveRecord::Base
has_many :doctors_doctor_branches, foreign_key: "doctor_id", dependent: :destroy
has_many :doctor_branches, through: :doctors_doctor_branches
def as_indexed_json(options={})
as_json(
include: {
doctor_branches: {only: [:id, :name]}
}
)
end
end
關係是正確的,因爲爲什麼彈性搜索不索引的相關醫生和DoctorBranch之間
Doctor.find(1).doctor_branches
給我AR陣列。但是當我做
response = Doctor.__elasticsearch__.search 'Yoga'
我沒有得到響應結果。