2021-03-20 03:26:48 -04:00
|
|
|
# OpenSearch REST API JSON specification
|
2013-05-24 05:23:25 -04:00
|
|
|
|
2021-03-20 03:26:48 -04:00
|
|
|
This repository contains a collection of JSON files which describe the [OpenSearch](https://github.com/opensearch-project/OpenSearch) HTTP API.
|
2013-05-24 05:23:25 -04:00
|
|
|
|
|
|
|
Their purpose is to formalize and standardize the API, to facilitate development of libraries and integrations.
|
|
|
|
|
2020-02-03 09:50:11 -05:00
|
|
|
Example for the ["Create Index"](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) API:
|
2013-05-24 05:23:25 -04:00
|
|
|
|
|
|
|
```json
|
2013-05-28 04:55:24 -04:00
|
|
|
{
|
|
|
|
"indices.create": {
|
2019-08-16 08:40:00 -04:00
|
|
|
"documentation":{
|
2020-02-03 09:50:11 -05:00
|
|
|
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html"
|
2019-08-16 08:40:00 -04:00
|
|
|
},
|
2019-06-17 10:57:13 -04:00
|
|
|
"stability": "stable",
|
2019-08-16 08:40:00 -04:00
|
|
|
"url":{
|
|
|
|
"paths":[
|
|
|
|
{
|
|
|
|
"path":"/{index}",
|
|
|
|
"method":"PUT",
|
|
|
|
"parts":{
|
|
|
|
"index":{
|
|
|
|
"type":"string",
|
|
|
|
"description":"The name of the index"
|
|
|
|
}
|
|
|
|
}
|
2013-05-24 05:23:25 -04:00
|
|
|
}
|
2019-08-16 08:40:00 -04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"params": {
|
|
|
|
"timeout": {
|
|
|
|
"type" : "time",
|
|
|
|
"description" : "Explicit operation timeout"
|
2013-05-24 05:23:25 -04:00
|
|
|
}
|
2013-05-28 04:55:24 -04:00
|
|
|
},
|
|
|
|
"body": {
|
|
|
|
"description" : "The configuration for the index (`settings` and `mappings`)"
|
2013-05-24 05:23:25 -04:00
|
|
|
}
|
2013-05-28 04:55:24 -04:00
|
|
|
}
|
|
|
|
}
|
2013-05-24 05:23:25 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
The specification contains:
|
|
|
|
|
|
|
|
* The _name_ of the API (`indices.create`), which usually corresponds to the client calls
|
2020-03-23 07:36:37 -04:00
|
|
|
* Link to the documentation at the <http://elastic.co> website.
|
|
|
|
|
|
|
|
**IMPORANT:** This should be a _live_ link. Several downstream ES clients use
|
|
|
|
this link to generate their documentation. Using a broken link or linking to
|
|
|
|
yet-to-be-created doc pages can break the [Elastic docs
|
|
|
|
build](https://github.com/elastic/docs#building-documentation).
|
2019-06-17 10:57:13 -04:00
|
|
|
* `stability` indicating the state of the API, has to be declared explicitly or YAML tests will fail
|
2019-08-16 08:40:00 -04:00
|
|
|
* `experimental` highly likely to break in the near future (minor/path), no bwc guarantees.
|
2019-06-17 10:57:13 -04:00
|
|
|
Possibly removed in the future.
|
|
|
|
* `beta` less likely to break or be removed but still reserve the right to do so
|
2019-08-16 08:40:00 -04:00
|
|
|
* `stable` No backwards breaking changes in a minor
|
|
|
|
* Request URL: HTTP method, path and parts
|
|
|
|
* Request parameters
|
|
|
|
* Request body specification
|
2013-05-24 05:23:25 -04:00
|
|
|
|
2019-08-16 08:40:00 -04:00
|
|
|
**NOTE**
|
2019-06-17 10:57:13 -04:00
|
|
|
If an API is stable but it response should be treated as an arbitrary map of key values please notate this as followed
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"api.name": {
|
|
|
|
"stability" : "stable",
|
|
|
|
"response": {
|
|
|
|
"treat_json_as_key_value" : true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-08-16 08:40:00 -04:00
|
|
|
## Backwards compatibility
|
2019-06-17 10:57:13 -04:00
|
|
|
|
2021-03-20 03:26:48 -04:00
|
|
|
The specification follows the same backward compatibility guarantees as OpenSearch.
|
2019-06-11 09:15:11 -04:00
|
|
|
|
2019-08-16 08:40:00 -04:00
|
|
|
- Within a Major, additions only.
|
|
|
|
- If an item has been documented wrong it should be deprecated instead as removing these might break downstream clients.
|
2019-06-11 09:15:11 -04:00
|
|
|
- Major version change, may deprecate pieces or simply remove them given enough deprecation time.
|
|
|
|
|
|
|
|
## Deprecations
|
|
|
|
|
2019-08-16 08:40:00 -04:00
|
|
|
The specification schema allows to codify API deprecations, either for an entire API, or for specific parts of the API, such as paths or parameters.
|
2019-06-11 09:15:11 -04:00
|
|
|
|
|
|
|
#### Entire API:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"api" : {
|
|
|
|
"deprecated" : {
|
|
|
|
"version" : "7.0.0",
|
|
|
|
"description" : "Reason API is being deprecated"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-08-16 08:40:00 -04:00
|
|
|
#### Specific paths and their parts:
|
2019-06-11 09:15:11 -04:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"api": {
|
|
|
|
"url": {
|
2019-08-16 08:40:00 -04:00
|
|
|
"paths": [
|
2019-06-11 09:15:11 -04:00
|
|
|
{
|
2019-08-16 08:40:00 -04:00
|
|
|
"path":"/{index}/{type}/{id}/_create",
|
|
|
|
"method":"PUT",
|
|
|
|
"parts":{
|
|
|
|
"id":{
|
|
|
|
"type":"string",
|
|
|
|
"description":"Document ID"
|
|
|
|
},
|
|
|
|
"index":{
|
|
|
|
"type":"string",
|
|
|
|
"description":"The name of the index"
|
|
|
|
},
|
|
|
|
"type":{
|
|
|
|
"type":"string",
|
|
|
|
"description":"The type of the document",
|
|
|
|
"deprecated":true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"deprecated":{
|
|
|
|
"version":"7.0.0",
|
|
|
|
"description":"Specifying types in urls has been deprecated"
|
|
|
|
}
|
2019-06-11 09:15:11 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-08-16 08:40:00 -04:00
|
|
|
#### Parameters
|
2019-06-11 09:15:11 -04:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"api": {
|
|
|
|
"url": {
|
|
|
|
"params": {
|
|
|
|
"stored_fields": {
|
|
|
|
"type": "list",
|
|
|
|
"description" : "",
|
|
|
|
"deprecated" : {
|
|
|
|
"version" : "7.0.0",
|
|
|
|
"description" : "Reason parameter is being deprecated"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2013-05-24 05:23:25 -04:00
|
|
|
## License
|
|
|
|
|
2014-11-07 23:57:13 -05:00
|
|
|
This software is licensed under the Apache License, version 2 ("ALv2").
|