searchkick - [标准] 标记过滤器已被删除
searchkick - The [standard] token filter has been removed
这是我的用户模型 searchkick 配置。
# frozen_string_literal: true
class User < ApplicationRecord
# ..
searchkick word_start: [:company_name],
callbacks: :async,
filterable: %i[id role bidded_to_projects],
searchable: [:company_name]
has_many :projects
has_many :bids, foreign_key: :contractor_id
def search_data
{
company_name: company_name,
role: present_role,
id: id,
bidded_to_projects: bidded_to_projects
}
end
def bidded_to_projects
bids.joins(:project).select('projects.id').map(&:id)
end
class << self
def fetch_contractors_to_invite(project_id:, sender_id:, search_text:)
users_invited_by_current_user =
User
.joins(:received_invitations)
.where('projects_invites.project_id = ? AND projects_invites.sender_id = ?',
project_id,
sender_id)
.pluck('users.id')
User.search(
search_text,
fields: [:company_name],
where: {
role: User::CONTRACTOR,
id: { not: users_invited_by_current_user },
bidded_to_projects: { not: project_id }
},
match: :word_start,
includes: [:company_profile]
)
end
end
当我尝试对其编制索引时出现如下错误。
irb(main):002:0> User.reindex
Traceback (most recent call last):
1: from (irb):2
Elasticsearch::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The [standard] token filter has been removed."}],"type":"illegal_argument_exception","reason":"The [standard] token filter has been removed."},"status":400})
irb(main):003:0>
我的代码有什么问题导致了这个错误的发生?
如 official ES Standard token filter reference 中所述,它已被弃用并从 ES 7.X
中删除
这是我的用户模型 searchkick 配置。
# frozen_string_literal: true
class User < ApplicationRecord
# ..
searchkick word_start: [:company_name],
callbacks: :async,
filterable: %i[id role bidded_to_projects],
searchable: [:company_name]
has_many :projects
has_many :bids, foreign_key: :contractor_id
def search_data
{
company_name: company_name,
role: present_role,
id: id,
bidded_to_projects: bidded_to_projects
}
end
def bidded_to_projects
bids.joins(:project).select('projects.id').map(&:id)
end
class << self
def fetch_contractors_to_invite(project_id:, sender_id:, search_text:)
users_invited_by_current_user =
User
.joins(:received_invitations)
.where('projects_invites.project_id = ? AND projects_invites.sender_id = ?',
project_id,
sender_id)
.pluck('users.id')
User.search(
search_text,
fields: [:company_name],
where: {
role: User::CONTRACTOR,
id: { not: users_invited_by_current_user },
bidded_to_projects: { not: project_id }
},
match: :word_start,
includes: [:company_profile]
)
end
end
当我尝试对其编制索引时出现如下错误。
irb(main):002:0> User.reindex
Traceback (most recent call last):
1: from (irb):2
Elasticsearch::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The [standard] token filter has been removed."}],"type":"illegal_argument_exception","reason":"The [standard] token filter has been removed."},"status":400})
irb(main):003:0>
我的代码有什么问题导致了这个错误的发生?
如 official ES Standard token filter reference 中所述,它已被弃用并从 ES 7.X
中删除