gpt4 book ai didi

ruby-on-rails - searchkick 400 [searchkick_search] 未找到

转载 作者:数据小太阳 更新时间:2023-10-29 08:03:18 24 4
gpt4 key购买 nike

有人在使用 searchkick 时遇到这种问题吗?我做错事情了?有人可以给个提示吗?

谢谢

Controller :

@products = Product.search(params[:query], page: params[:page])

型号:

after_touch :reindex

searchkick mappings: {
product: {
properties: {
name: {type: "string", analyzer: "keyword"}
}
}
}
def search_data
as_json only: [:name, :price]
# or equivalently
{
name: name,
price: price
}
end

[400] {"error":{"root_cause":[{"type":"query_parsing_exception","reason":"[match] analyzer [searchkick_search] not found","index":"products_development_20151125203817235","line":1,"col":89}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"products_development_20151125203817235","node":"f2jvKNboRcGf0NF11yEqyw","reason":{"type":"query_parsing_exception","reason":"[match] analyzer [searchkick_search] not found","index":"products_development_20151125203817235","line":1,"col":89}}]},"status":400}

最佳答案

将您的 merge_mappings 变量设置为 true

after_touch :reindex

searchkick merge_mappings: true, mappings: {
product: {
properties: {
name: {type: "string", analyzer: "keyword"}
}
}
}
def search_data
as_json only: [:name, :price]
# or equivalently
{
name: name,
price: price
}
end

然后运行 ​​rake searchkick:reindex:allModel.reindex

希望这对您有所帮助。祝你好运!

关于ruby-on-rails - searchkick 400 [searchkick_search] 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33929091/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com