添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
天涯  ·  《Prometheus监控实战》第9章 ...·  2 年前    · 
18330380933  ·  ruby on rails - Why ...·  3 年前    · 
crhgxdqw  ·  Ruby 简明教程 高级进阶 Part ...·  3 年前    · 
13975858069  ·  GitLab ...·  3 年前    · 
13975858069  ·  Navigating GitLab via ...·  3 年前    · 
还单身的弓箭  ·  在SSIS中使用临时表·  9 月前    · 
英俊的羊肉串  ·  The supplied data ...·  1 年前    · 
气势凌人的灯泡  ·  apache spark sql - ...·  1 年前    · 

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more

Why does Searchkick::ImportError - “type”=>“unavailable_shards_exception”, “reason”=> “Primary Shard is not active” occur?

Ask Question

I am using searchkick gem in Rails 5.2.2 and trying to Index the User model through rails console. User.reindex is returning this error:

Searchkick::ImportError ({"type"=>"unavailable_shards_exception", "reason"=>"[users_production_20191118071025562][3] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[users_production_20191118071025562][3]] containing [52] requests]"} on item with id '1')

This is my config/initializers/searchkick.rb initializer file:

url = begin
        ENV['ELASTICSEARCH_URL']
      rescue StandardError
        "localhost"
Searchkick.client = Elasticsearch::Client.new(
 hosts:             ["http://#{url}"],
 retry_on_failure:  true,
 transport_options: {
   request: {
     timeout: 450

Output of 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"

Output of 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
                Could you share the output of these  curl -XGET "localhost:9200" and curl -XGET "localhost:9200/_cluster/health"
– Addicted
                Nov 19 '19 at 15:19
                @Addicted - Thanks for asking, I have added these in the Question description itself.
– Tanya Saroha
                Nov 20 '19 at 4:46
                As you see from cluster health that there 20 unassigned_shards. Please refer to post shared by @Ajay.
– Addicted
                Nov 20 '19 at 9:44
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.