I am using Elasticsearch in a Rails application through the Elasticsearch-rails gem. After creating the indexes, I want to import the data into these indexes. But I am getting the following error:
The following snippet of code is my model configuration:
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
settings index: { number_of_shards: 1 } do
mappings dynamic: 'false' do
# Define your mapping properties here if needed
indexes :name
end
end
def self.search(query)
# Your search logic goes here
# For example: self.__elasticsearch__.search(query).records.to_a
end
end
end
And then while connected to the database I run the commands to create index: Model.__elasticsearch__.create_index! and after that import to these index Model.__elasticsearch__.import thats when i get the error.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.