<p dir="auto">When you <code class="notranslate">curl ip:9200/name/_mappings</code> (or <code class="notranslate">_settings</code>, for example), you get a response with the JSON object.</p>
<p dir="auto">But when you do  <code class="notranslate">curl -I ip:9200/name/_mappings</code>, you get 404.</p>
<p dir="auto">Why? Because <code class="notranslate">-I</code> is not a GET operation, but a HEAD one, and it's not implemented.</p>
<p dir="auto">I think this is strange behaviour. According to <a href="https://tools.ietf.org/html/rfc2616#section-9.4" rel="nofollow">HTTP protocol spec</a>:</p>
<blockquote>
<p dir="auto">The HEAD method is identical to GET except that the server MUST NOT<br>
return a message-body in the response. The metainformation contained<br>
in the HTTP headers in response to a HEAD request SHOULD be identical<br>
to the information sent in response to a GET request.</p>
</blockquote>
<p dir="auto">So would be nice to have the HEAD acting the same as GET here (without body response), instead of returning 404. I wasted some time trying to figure out what was wrong until i removed <code class="notranslate">-I</code> <g-emoji class="g-emoji" alias="confused" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f615.png">😕</g-emoji></p>
<p dir="auto">Today, if a request is executed against an endpoint with a method in the request line that that endpoint does not support, Elasticsearch responds with a response like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;error&quot; : {
    &quot;root_cause&quot; : [ {
      &quot;type&quot; : &quot;illegal_argument_exception&quot;,
      &quot;reason&quot; : &quot;No feature for name [_forcemerge]&quot;
    } ],
    &quot;type&quot; : &quot;illegal_argument_exception&quot;,
    &quot;reason&quot; : &quot;No feature for name [_forcemerge]&quot;
  },
  &quot;status&quot; : 400
}"><pre class="notranslate"><code class="notranslate">{
  "error" : {
    "root_cause" : [ {
      "type" : "illegal_argument_exception",
      "reason" : "No feature for name [_forcemerge]"
    } ],
    "type" : "illegal_argument_exception",
    "reason" : "No feature for name [_forcemerge]"
  },
  "status" : 400
}
</code></pre></div>
<p dir="auto">This is confusing for users*, semantically wrong, and contrary to the HTTP spec. Instead, Elasticsearch should respond with <a href="https://tools.ietf.org/html/rfc2616#section-10.4.6" rel="nofollow">HTTP status code 405</a> (Method Not Allowed) and include in the Allow header a list of methods that the endpoint does support.</p>
<p dir="auto">*: <a href="https://www.google.com/search?q=no+feature+for+name+elasticsearch" rel="nofollow">Googling "no feature for name elasticsearch"</a> just leads to pages describing issues when an <a href="https://github.com/elastic/elasticsearch/blob/20bff773eda14804a77f6b76d98d8ea63ba6f4b9/core/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java#L75-L82">index is missing</a>.</p>