-
Notifications
You must be signed in to change notification settings - Fork 801
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
[MODEL] Automatic index configuration using .yml or .json files #351
Conversation
after testing in an actual Rails app
+1 |
Hey @karmi, Hope you had a great vacation, just a friendly reminder of these changes. |
@dabit Sorry for the long delay! I got stalled with stuff after the return. I'm not entirely sold on the "convention over configuration" approach in this case, I must say... I like the original approach much more... This also makes it dependent on Rails' |
… or JSON file This change allows you to specify a YAML file with settings for the indices. It would be helpful if you want to reuse analyzers in many different indexes. Also, YAML is much more readable than hashes in ruby code. Example: # config/elasticsearch/custom_analyzers.yml # # number_of_shards: 5 # analysis: # analyzer: # my_custom_analyzer: # tokenizer: "whitespace" # filter: ["lowercase", "asciifolding"] # class Article include Elasticsearch::Model settings "config/elasticsearch/custom_analyzers.yml" end class Author include Elasticsearch::Model settings "config/elasticsearch/custom_analyzers.yml" end Closes: #346 Closes: #351
Closed via 5c7cd12 |
With this patch, the
elasticsearch-model
gem will search for .yml or .json files named after thedocument_type
of every class and load it into@settings
and@mappings
accordingly.From README:
Configuration files
Elasticseach-model will automatically load settings and mappings included in
a .yml or .json file named after the
document_type
that exists inconfig/elasticsearch
for any specific class.