{"action":"opened","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/578","repository_url":"https://api.github.com/repos/elastic/elasticsearch-rails","labels_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/578/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/578/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/578/events","html_url":"https://github.com/elastic/elasticsearch-rails/issues/578","id":159190528,"number":578,"title":"How to define the settings of an implicitly-created index","user":{"login":"lbrito1","id":2048939,"avatar_url":"https://avatars.githubusercontent.com/u/2048939?v=3","gravatar_id":"","url":"https://api.github.com/users/lbrito1","html_url":"https://github.com/lbrito1","followers_url":"https://api.github.com/users/lbrito1/followers","following_url":"https://api.github.com/users/lbrito1/following{/other_user}","gists_url":"https://api.github.com/users/lbrito1/gists{/gist_id}","starred_url":"https://api.github.com/users/lbrito1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbrito1/subscriptions","organizations_url":"https://api.github.com/users/lbrito1/orgs","repos_url":"https://api.github.com/users/lbrito1/repos","events_url":"https://api.github.com/users/lbrito1/events{/privacy}","received_events_url":"https://api.github.com/users/lbrito1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-08T15:16:11Z","updated_at":"2016-06-08T15:16:11Z","closed_at":null,"body":"One can easily define a dynamic `index_name` by passing a callable object to the method, as implemented in [this commit](https://github.com/elastic/elasticsearch-rails/pull/159/files) of `elasticsearch-rails`. A dynamic `index_name` implies indirect creation of indices by Elasticsearch as new data arrives and the `index_name` changes. However, there doesn't seem to be a simple way to call `settings` _right after the creation of a new index_. So we're effectively stuck with the default settings.\r\n\r\nAll the examples [here](https://github.com/elastic/elasticsearch-rails/blob/92f0148af8849dac154ee41bd1c3dd868b421b86/elasticsearch-model/lib/elasticsearch/model/indexing.rb#L189) presume a asynchronous call to the model, e.g. `Article.settings File.open(\"config/elasticsearch/articles.yml\")`. This is fine when you're using a static `index_name`, but if the name changes then you should be able to define the new index's settings as well, am I right?\r\n\r\nMy personal motivation is that I have month-based indices being created dynamically: `index_name ->{ \"#{base_index_name}_#{date_suffix}\" }`. As new data arrives and the new indices are implicitly created by Elasticsearch, I need them to load the default settings in a yaml. I would expect some kind of hook that would be called after the creation of a new index."}}
{"actor":{"display_login":"lbrito1"}}