gpt4 book ai didi

ruby-on-rails - 如何在Ruby on Rails中禁用Elasticsearch动态映射?

转载 作者:行者123 更新时间:2023-12-03 00:30:26 27 4
gpt4 key购买 nike

在elasticsearch.org网站上,您指出可以通过index.mapper.dynamic将默认动态映射设置为false。我要在初始化文件夹中创建tire文件来执行此操作吗?

最佳答案

否。只需使用此样式即可创建映射

class Something < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks

settings
:mapper => {
"dynamic" => "false"
} do
mapping { indexes :bar, :type => 'string', :analyzer => "url_analyzer" }
end
end

关于ruby-on-rails - 如何在Ruby on Rails中禁用Elasticsearch动态映射?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13105015/

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