Browse Source

Rest: remove status code from main action

Today we give the HTTP status back within the HTTP response itself and within the JSON response as well:

```sh
curl localhost:9200/
```

```js
{
  "status" : 200,
  "name" : "Red Wolf",
  "version" : {
    "number" : "2.0.0",
    "build_hash" : "6837a61d8a646a2ac7dc8da1ab3c4ab85d60882d",
    "build_timestamp" : "2014-08-19T13:55:56Z",
    "build_snapshot" : true,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"
}
```
David Pilato 11 years ago
parent
commit
052645903a

+ 5 - 0
docs/reference/migration/migrate_2_0.asciidoc

@@ -89,6 +89,11 @@ with values in a single array.
 }
 ---------------
 
+=== Main API
+
+Previously, calling `GET /` was giving back the http status code within the json response
+in addition to the actual HTTP status code. We removed `status` field in json response.
+
 === Java API
 
 Some query builders have been removed or renamed:

+ 0 - 1
rest-api-spec/test/info/10_info.yaml

@@ -1,7 +1,6 @@
 ---
 "Info":
     - do:         {info: {}}
-    - match:      {status: 200}
     - is_true:    name
     - is_true:    cluster_name
     - is_true:    tagline

+ 0 - 1
rest-api-spec/test/info/20_lucene_version.yaml

@@ -1,7 +1,6 @@
 ---
 "Lucene Version":
     - do:         {info: {}}
-    - match:      {status: 200}
     - is_true:    version.lucene_version
 
 

+ 0 - 1
src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java

@@ -72,7 +72,6 @@ public class RestMainAction extends BaseRestHandler {
         }
 
         builder.startObject();
-        builder.field("status", status.getStatus());
         if (settings.get("name") != null) {
             builder.field("name", settings.get("name"));
         }