Blocked by: [FORBIDDEN/5/index read-only (api)];

Hi,
I am marked indices read_only and after apply force merge operation that same indices. i am getting below error. i am doing below steps. please help me.

Step1: GET my_indices/_settings

{

"my_indices" : {

"settings" : {

  "index" : {

    "creation_date" : "1554723807184",

    "number_of_shards" : "1",

    "number_of_replicas" : "2",

    "uuid" : "s080nZ7nSKGSfLg_9_53rQ",

    "version" : {

      "created" : "6050499"

    },

    "provided_name" : "my_indices"

  }

}

}

}

Step2: PUT my_indices/_settings

{

"index": {

"blocks.read_only": true

}

}

{

"my_indices" : {

"settings" : {

  "index" : {

    "number_of_shards" : "1",

    "blocks" : {

      "read_only" : "true"

    },

    "provided_name" : "my_indices",

    "creation_date" : "1554723807184",

    "number_of_replicas" : "2",

    "uuid" : "s080nZ7nSKGSfLg_9_53rQ",

    "version" : {

      "created" : "6050499"

    }

  }

}

}

}

Step3: POST /my_indices/_forcemerge?max_num_segments=1

"error": {

"root_cause": [

  {

    "type": "cluster_block_exception",

    "reason": "blocked by: [FORBIDDEN/5/index read-only (api)];"

  }

],

"type": "cluster_block_exception",

"reason": "blocked by: [FORBIDDEN/5/index read-only (api)];"

},

"status": 403

}

Thanks,
gnanendra

You need to run the merge before you set it as read only.

The whole idea of read only is that you cannot change it, on any level.

Hi warkolm,

but first i am changing indices read only after i apply force merge operation on that indices.

please refre this one:

Force merge should only be called against read-only indices . Running force merge against a read-write index can cause very large segments to be produced (>5Gb per segment), and the merge policy will never consider it for merging again until it mostly consists of deleted docs. This can cause very large segments to remain in the shards.

please help me.

Thanks,
gnanendra

I think this is a bug in the docs. What it is trying to say is that you should only force merge on an index that you will never change in future: you must:

  1. stop indexing to this index
  2. force merge it
  3. set index.blocks.read_only: true

The index is technically read-only as soon as you stop indexing into it, i.e. step 1, but you cannot apply the block until after step 2.

1 Like

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