lib/tire/model/indexing.rb
# Creates the corresponding index with desired settings and mappings, when it does not exists yet.
#
Creates the corresponding index with desired settings and mappings, when it does not exists yet.
Creates the corresponding index with desired settings and mappings when it does not exists yet .
def create_elasticsearch_index
          unless index.exists?
            new_index = index
            unless result = new_index.create(:mappings => mapping_to_hash, :settings => settings)
              STDERR.puts "[ERROR] There has been an error when creating the index -- elasticsearch returned:",
                          new_index.response
              result
            end
          end
        rescue *Tire::Configuration.client.__host_unreachable_exceptions => e
          STDERR.puts "Skipping index creation, cannot connect to Elasticsearch",
                      "(The original exception was: #{e.inspect})"
          false
        end
def create_elasticsearch_index unless index . exists? new_index = index unless result = new_index . create ( :mappings => mapping_to_hash , :settings => settings ) STDERR . puts "[ERROR] There has been an error when creating the index -- elasticsearch returned:" , new_index . response result end end rescue * Tire :: Configuration . client . __host_unreachable_exceptions => e STDERR . puts "Skipping index creation, cannot connect to Elasticsearch" , "(The original exception was: #{e.inspect})" false end
Creates the corresponding index with desired settings and mappings, when it does not exists yet.
Creates the corresponding index with desired settings and mappings when it does not exists yet .