Skip to content

Commit

Permalink
Switch indices.exists_type from {index}/{type} to `{index}/_mapping…
Browse files Browse the repository at this point in the history
…/{type}`. elastic#20055

This will help remove types as we will need `{index}/{id}` to tell whether a
document exists.

Relates elastic#15613
  • Loading branch information
jpountz committed Aug 19, 2016
1 parent 207d3a6 commit a4ea7e7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public class RestTypesExistsAction extends BaseRestHandler {
@Inject
public RestTypesExistsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(HEAD, "/{index}/{type}", this);
controller.registerWithDeprecatedHandler(
HEAD, "/{index}/_mapping/{type}", this,
HEAD, "/{index}/{type}", deprecationLogger);
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion docs/reference/indices/indices-exists.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Used to check if the index (indices) exists or not. For example:

[source,js]
--------------------------------------------------
curl -XHEAD -i 'http://localhost:9200/twitter'
HEAD twitter
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]

The HTTP status code indicates if the index exists or not. A `404` means
it does not exist, and `200` means it does.
4 changes: 3 additions & 1 deletion docs/reference/indices/types-exists.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Used to check if a type/types exists in an index/indices.

[source,js]
--------------------------------------------------
curl -XHEAD -i 'http://localhost:9200/twitter/tweet'
HEAD twitter/_mapping/tweet
--------------------------------------------------
// CONSOLE
// TEST[setup:twitter]

The HTTP status code indicates if the type exists or not. A `404` means
it does not exist, and `200` means it does.
7 changes: 7 additions & 0 deletions docs/reference/migration/migrate_5_0/rest.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ The `GET` HTTP verb for `/_forcemerge` is no longer supported, please use the
It used to be possible to create an index by either calling `PUT index_name`
or `POST index_name`. Only the former is now supported.

==== `HEAD {index}/{type}` replaced with `HEAD {index}/_mapping/{type}`

The endpoint for checking whether a type exists has been changed from
`{index}/{type}` to `{index}/_mapping/{type}` in order to prepare for the
removal of types when `HEAD {index}/{id}` will be used to check whether a
document exists in an index. The old endpoint will keep working until 6.0.

==== Removed `mem` section from `/_cluster/stats` response

The `mem` section contained only one value, the total memory available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html",
"methods": ["HEAD"],
"url": {
"path": "/{index}/{type}",
"paths": ["/{index}/{type}"],
"path": "/{index}/_mapping/{type}",
"paths": ["/{index}/_mapping/{type}"],
"parts": {
"index": {
"type" : "list",
Expand Down

0 comments on commit a4ea7e7

Please sign in to comment.