提问者:小点点

为什么会发生SearchKick::的重要错误-"类型"=>"unavailable_shards_exception","原因"=>"主分片不活动"?


我正在Rails 5.2.2中使用search chkigem并尝试通过rails控制台索引用户模型。User. reindex返回此错误:

SearchKick::重要错误({"type"=

这是我的配置/初始化程序/search chkick. rb初始化程序文件:

url = begin
        ENV['ELASTICSEARCH_URL']
      rescue StandardError
        "localhost"
      end

Searchkick.client = Elasticsearch::Client.new(
 hosts:             ["http://#{url}"],
 retry_on_failure:  true,
 transport_options: {
   request: {
     timeout: 450
   }
 }
)

curl的输出-XGET"localhost:9200"

  "name" : "RZdkAgz",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "PG5iZcMnQB677DBW2jStuA",
  "version" : {
    "number" : "6.7.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "8453f77",
    "build_date" : "2019-03-21T15:32:29.844721Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

curl的输出-XGET"localhost:9200/_cluster/health?pretty"

  "cluster_name" : "elasticsearch",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 20,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 0.0
}

共1个答案

匿名用户

一个原因可能是,节点刚刚加入集群,但还没有分配任何分片。有关更多信息,请参阅这篇文章:未分配的分片