-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add new field to existed index? #692
Comments
I think we don't have such an option on chewy. What you can do is try to update the index definition with our DSL and reindex the entire index. Or you can create a new one asynchronous and drop the old in favor of the new one when it's ready. |
@darkleaf this hack might help:
And then to initialize new field value:
But field definition must be specified manually in elasticsearch syntax as close as possible to ones created by Chewy. |
We use this rake task task :put_mapping => :environment do
Dir["#{Rails.root}/app/chewy/**/*.rb"].each { |file| require_dependency file }
Chewy::Type.descendants.each do |type|
Chewy.client.indices.put_mapping index: type.index_name,
type: type.type_name,
body: type.mappings_hash
end
end |
I have an existed index and I want to add a new field into it without reindex.
Elasticsearch has the put mapping api.
The text was updated successfully, but these errors were encountered: