{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/9203","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/9203/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/9203/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/9203/events","html_url":"https://github.com/elastic/elasticsearch/pull/9203","id":53777566,"number":9203,"title":"Internal: Add METADATA_READ and METADATA_WRITE blocks","user":{"login":"tlrx","id":642733,"avatar_url":"https://avatars.githubusercontent.com/u/642733?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrx","html_url":"https://github.com/tlrx","followers_url":"https://api.github.com/users/tlrx/followers","following_url":"https://api.github.com/users/tlrx/following{/other_user}","gists_url":"https://api.github.com/users/tlrx/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrx/subscriptions","organizations_url":"https://api.github.com/users/tlrx/orgs","repos_url":"https://api.github.com/users/tlrx/repos","events_url":"https://api.github.com/users/tlrx/events{/privacy}","received_events_url":"https://api.github.com/users/tlrx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v2.0.0","name":"v2.0.0","color":"dddddd"}],"state":"open","locked":false,"assignee":{"login":"javanna","id":832460,"avatar_url":"https://avatars.githubusercontent.com/u/832460?v=3","gravatar_id":"","url":"https://api.github.com/users/javanna","html_url":"https://github.com/javanna","followers_url":"https://api.github.com/users/javanna/followers","following_url":"https://api.github.com/users/javanna/following{/other_user}","gists_url":"https://api.github.com/users/javanna/gists{/gist_id}","starred_url":"https://api.github.com/users/javanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javanna/subscriptions","organizations_url":"https://api.github.com/users/javanna/orgs","repos_url":"https://api.github.com/users/javanna/repos","events_url":"https://api.github.com/users/javanna/events{/privacy}","received_events_url":"https://api.github.com/users/javanna/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2015-01-08T17:32:57Z","updated_at":"2015-04-02T09:42:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/9203","html_url":"https://github.com/elastic/elasticsearch/pull/9203","diff_url":"https://github.com/elastic/elasticsearch/pull/9203.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/9203.patch"},"body":"While looking at #3703, it looks like the usage of 'read_only' is a bit confusing.\r\n\r\nThe documentation stipulates:\r\n> index.blocks.read_only\r\n> Set to true to have the index read only, false to allow writes and metadata changes.\r\n\r\nActually, it blocks all write operations (creating, indexing or deleting a document) but also all read/write operations on index metadata. This can lead to confusion because subsequent 'indices exists' requests will return an undocumented 403 Forbidden response code where one could expect a 200 OK (as reported in #3703). Same for 'type exists' and 'alias exists' requests.\r\n\r\nSimilar issues have been reported:\r\n- _status #2833 (deprecated in 1.2.0)\r\n- _stats #5876\r\n- /_cat/indices #5855\r\n\r\nBut several API calls returns a 403 when at least one index of the cluster has 'index.blocks.read_only' set to true:\r\n```\r\nDELETE /_all\r\n\r\nPOST /library/book/1\r\n{\r\n  \"title\": \"Elasticsearch: the definitive guide\"\r\n}\r\n\r\nPOST /movies/dvd/1\r\n{\r\n  \"title\": \"Elasticsearch: the movie\"\r\n}\r\n\r\nPUT /library/_settings\r\n{\r\n  \"index\": {\r\n    \"blocks.read_only\": true\r\n  }\r\n}\r\n```\r\nThe following calls will return 403 / \"ClusterBlockException[blocked by: [FORBIDDEN/5/index read-only (api)];]\":\r\n```\r\nHEAD /library\r\nHEAD /library/book\r\nHEAD /_all/dvd\r\n\r\nGET /library/_settings\r\nGET /library/_mappings\r\nGET /library/_warmers\r\nGET /library/_aliases\r\n\r\nGET /_settings\r\nGET /_aliases\r\nGET /_mappings\r\nGET /_cat/indices\r\n```\r\nI agree to @imotov's comment (see https://github.com/elasticsearch/elasticsearch/pull/5876#issuecomment-42273841) and I think we should split the METADATA blocks in METADATA_READ & METADATA_WRITE blocks. This way the 'read_only' setting will block all write operations and metadata updates but the metadata will still be available.\r\n\r\nThis is a first step before updating all other actions then removing METADATA block completely.\r\n\r\nCloses #3703\r\nCloses #8102"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/88848967","html_url":"https://github.com/elastic/elasticsearch/pull/9203#issuecomment-88848967","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/9203","id":88848967,"user":{"login":"javanna","id":832460,"avatar_url":"https://avatars.githubusercontent.com/u/832460?v=3","gravatar_id":"","url":"https://api.github.com/users/javanna","html_url":"https://github.com/javanna","followers_url":"https://api.github.com/users/javanna/followers","following_url":"https://api.github.com/users/javanna/following{/other_user}","gists_url":"https://api.github.com/users/javanna/gists{/gist_id}","starred_url":"https://api.github.com/users/javanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javanna/subscriptions","organizations_url":"https://api.github.com/users/javanna/orgs","repos_url":"https://api.github.com/users/javanna/repos","events_url":"https://api.github.com/users/javanna/events{/privacy}","received_events_url":"https://api.github.com/users/javanna/received_events","type":"User","site_admin":false},"created_at":"2015-04-02T09:42:05Z","updated_at":"2015-04-02T09:42:05Z","body":"looks great @tlrx thanks for all the tests you wrote, I left a bunch of comments. Given that we are handling bw comp, we can mark this for 1.6 too (at least) I think.\r\n\r\nI think we have yet to migrate some apis to not use the deprecated `METADATA` block right?\r\n\r\nAlso, as a follow-up might it make sense to deprecate the `index.blocks.metadata` setting and expose the distinction there between reads and writes now that we support it, as we do with data?"}}