Create index fails with shard_acknowledged = false

Hi,

I'm using elastic 6.1 on CentOS 7. The server is a bit slow. When I try to create an index using this command:

curl -XPUT 'localhost:9200/user_activity?pretty' -H 'Content-Type: application/json' -d'
{
    "settings" : {
        "index" : {
            "codec": "best_compression",
            "number_of_shards" : 1,
            "number_of_replicas" : 0,
            "mapper.dynamic": false
        }
    },
    "mappings" : {
        "user_activity" : {
            "_all": { "enabled": false },
            "properties" : {
                "timestamp": { "type": "date"},
                "user_id": { "type": "integer"},
                ...
            }
        }
    }
}
'

it apparently works, but the output is like this:

{
  "acknowledged" : true,
  "shards_acknowledged" : false,
  "index" : "user_activity"
}

Then when I check index health, it's red:

health status index                         uuid                   pri rep docs.count docs.deleted store.size pri.store.size
red    open   user_activity                 DVG88zczRB21G155LB0DTw   1   0

And I cannot insert any document. I couldn't find anyway to retry shard allocation. So I kept deleting the index and recreating it. The logs look like this:

[2018-01-30T09:39:45,434][INFO ][o.e.c.m.MetaDataDeleteIndexService] [U62E07S] [user_activity/PYM7qf52RVONyRYYNP_iug] deleting index
[2018-01-30T09:39:48,696][INFO ][o.e.c.m.MetaDataCreateIndexService] [U62E07S] [user_activity] creating index, cause [api], templates [], shards [1]/[0], mappings [user_activity]
[2018-01-30T09:39:48,697][INFO ][o.e.c.r.a.AllocationService] [U62E07S] Cluster health status changed from [YELLOW] to [RED] (reason: [index [user_activity] created]).

and then the same message:

{
  "acknowledged" : true,
  "shards_acknowledged" : false,
  "index" : "user_activity"
}

Any idea how I can create the index?

Thanks

What response you get when you run:
curl -XGET 'localhost:9200/_cluster/allocation/explain' ?

2 Likes

Here is the output:

{
 “index”: “user_activity”,
 “shard”: 0,
 “primary”: true,
 “current_state”: “unassigned”,
 “unassigned_info”: {
   “reason”: “INDEX_CREATED”,
   “at”: “2018-01-30T14:39:48.696Z”,
   “last_allocation_status”: “no”
 },
 “can_allocate”: “no”,
 “allocate_explanation”: “cannot allocate because allocation is not permitted to any of the nodes”,
 “node_allocation_decisions”: [
   {
     “node_id”: “U62E07S0Tm2ux_ozxD2swA”,
     “node_name”: “U62E07S”,
     “transport_address”: “127.0.0.1:9300",
     “node_decision”: “no”,
     “weight_ranking”: 1,
     “deciders”: [
       {
         “decider”: “enable”,
         “decision”: “NO”,
         “explanation”: “no allocations are allowed due to cluster setting [cluster.routing.allocation.enable=none]”
       }
     ]
   }
 ]
}

I think I figured out the reason. I had recently upgraded from 5.6 to 6.1 and I forgot to re-enable shard allocation after the upgrade. I re-enabled the shard allocation, recreated the index and it worked as expected.

Thanks

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.