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'
我没有得到响应结果。