diff --git a/Gemfile b/Gemfile index 41cd58e957692a4233a221458ce2deaaaf34b8ed..bbf2035ff953b446ccff698e48d40a65c2ad3352 100644 --- a/Gemfile +++ b/Gemfile @@ -179,6 +179,6 @@ gem 'acts_as_list' gem 'faraday-net_http_persistent', '~> 2.0' -gem 'elasticsearch', '< 7.14' +gem 'elasticsearch', '~> 8.6' diff --git a/app/models/collection.rb b/app/models/collection.rb index 172f8714e986fa6b08b715630d2df6fe19dfa7ba..b88f3f1b9e9372652702becf86334b376dedb825 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -74,11 +74,9 @@ class Collection < ApplicationRecord scope :from_user, ->(user) { where(owner: user) } searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true, mappings: { - collection: { - properties: { - created_at: { - type: "date" - } + "properties": { + "created_at": { + "type": "date" } } } diff --git a/app/models/learning_object.rb b/app/models/learning_object.rb index 34e83db1125db6c8e90ff5f98cfc5f0aba15b53e..a526bece9ac14d9d25d4d81e5e677e0bf7d50ab8 100644 --- a/app/models/learning_object.rb +++ b/app/models/learning_object.rb @@ -99,8 +99,13 @@ class LearningObject < ApplicationRecord default_scope { includes(:object_type, :attachment, :attachments) } scope :missing_thumbnail, ->() { where(thumbnail_file_name: nil) } - searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type, :tags, :subjects, :educational_stages, :languages], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true - {"mappings": {"_doc": {"properties": {"published_at": { "type": "date" }}}}} + searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type, :tags, :subjects, :educational_stages, :languages], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true, mappings: { + "properties": { + "published_at": { + "type": "date" + } + } + } acts_as_paranoid scope :search_import, -> { includes(:object_type, :tags, :subjects, :educational_stages, :publisher) } diff --git a/config/env_vars.sh b/config/env_vars.sh index f13a13512609cd9797941aa3bca3f255bde1be46..b140ed10134d1a73ad7217994eafe92c4a5ff7d9 100644 --- a/config/env_vars.sh +++ b/config/env_vars.sh @@ -35,11 +35,11 @@ export PORTALMEC_DSPACE_PORT=8443 export PORTALMEC_DSPACE_HOST=mecdb4.c3sl.ufpr.br ### Elasticsearch credentials -export PORTALMEC_ELASTICSEARCH_LOGIN=portalmec -export PORTALMEC_ELASTICSEARCH_PASSWORD=elasticsearch +export PORTALMEC_ELASTICSEARCH_LOGIN=elastic +export PORTALMEC_ELASTICSEARCH_PASSWORD=123mudar export PORTALMEC_ELASTICSEARCH_PORT=9200 -#export PORTALMEC_ELASTICSEARCH_HOST=localhost -export PORTALMEC_ELASTICSEARCH_HOST=elasticsearchprod +export PORTALMEC_ELASTICSEARCH_HOST=localhost +#export PORTALMEC_ELASTICSEARCH_HOST=elasticsearchprod ### Cache export MEMCACHE_SERVERS=localhost diff --git a/config/initializers/elasticsearch.rb b/config/initializers/elasticsearch.rb index ca3584792cfacb999d94abb60f7ea67821d2b6d9..9a3b628ece9d05b53e0057027bb5652e122d92df 100644 --- a/config/initializers/elasticsearch.rb +++ b/config/initializers/elasticsearch.rb @@ -22,11 +22,15 @@ if Rails.env.production? host = ENV['PORTALMEC_ELASTICSEARCH_HOST'] port = ENV['PORTALMEC_ELASTICSEARCH_PORT'] elasticsearch_client = Elasticsearch::Client.new( - url: host + ":" + port, + url: "https://" + login + ":" + pass + "@" + host + ":" + port, transport_options: { request: { timeout: 550 - }#, + }, + ssl: { + verify: false + } + #, #headers: { # Authorization: "Basic " + Base64.strict_encode64(login + ":" + pass) #}