Method: Chewy::Index::Actions::ClassMethods#create
- Defined in:
- lib/chewy/index/actions.rb
#create(*args, **kwargs) ⇒ Object
Creates index and applies mappings and settings. Returns false in case of unsuccessful creation.
UsersIndex.create # creates index named users
Index name suffix might be passed optionally. In this case, method creates index with suffix and makes unsuffixed alias for it.
UsersIndex.create '01-2013' # creates index users_01-2013 and alias users for it
UsersIndex.create '01-2013', alias: false # creates index users_01-2013 only and no alias
Suffixed index names might be used for zero-downtime mapping change, for example. Description: (http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/).
33 34 35 36 37 |
# File 'lib/chewy/index/actions.rb', line 33 def create(*args, **kwargs) create!(*args, **kwargs) rescue Elastic::Transport::Transport::Errors::BadRequest false end |