mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
As per the new licensing change for Elasticsearch and Kibana this commit moves existing Apache 2.0 licensed source code to the new dual license SSPL+Elastic license 2.0. In addition, existing x-pack code now uses the new version 2.0 of the Elastic license. Full changes include: - Updating LICENSE and NOTICE files throughout the code base, as well as those packaged in our published artifacts - Update IDE integration to now use the new license header on newly created source files - Remove references to the "OSS" distribution from our documentation - Update build time verification checks to no longer allow Apache 2.0 license header in Elasticsearch source code - Replace all existing Apache 2.0 license headers for non-xpack code with updated header (vendored code with Apache 2.0 headers obviously remains the same). - Replace all Elastic license 1.0 headers with new 2.0 header in xpack.
176 lines
5.3 KiB
Markdown
176 lines
5.3 KiB
Markdown
# Elasticsearch REST API JSON specification
|
|
|
|
This repository contains a collection of JSON files which describe the [Elasticsearch](http://elastic.co) HTTP API.
|
|
|
|
Their purpose is to formalize and standardize the API, to facilitate development of libraries and integrations.
|
|
|
|
Example for the ["Create Index"](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) API:
|
|
|
|
```json
|
|
{
|
|
"indices.create": {
|
|
"documentation":{
|
|
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html"
|
|
},
|
|
"stability": "stable",
|
|
"url":{
|
|
"paths":[
|
|
{
|
|
"path":"/{index}",
|
|
"method":"PUT",
|
|
"parts":{
|
|
"index":{
|
|
"type":"string",
|
|
"description":"The name of the index"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"params": {
|
|
"timeout": {
|
|
"type" : "time",
|
|
"description" : "Explicit operation timeout"
|
|
}
|
|
},
|
|
"body": {
|
|
"description" : "The configuration for the index (`settings` and `mappings`)"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
The specification contains:
|
|
|
|
* The _name_ of the API (`indices.create`), which usually corresponds to the client calls
|
|
* 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).
|
|
* `stability` indicating the state of the API, has to be declared explicitly or YAML tests will fail
|
|
* `experimental` highly likely to break in the near future (minor/patch), no bwc guarantees.
|
|
Possibly removed in the future.
|
|
* `beta` less likely to break or be removed but still reserve the right to do so
|
|
* `stable` No backwards breaking changes in a minor
|
|
* Request URL: HTTP method, path and parts
|
|
* Request parameters
|
|
* Request body specification
|
|
|
|
**NOTE**
|
|
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
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## Type definition
|
|
In the documentation, you will find the `type` field, which documents which type every parameter will accept.
|
|
|
|
#### Querystring parameters
|
|
| Type | Description |
|
|
|---|---|
|
|
| `list` | An array of strings *(represented as a comma separated list in the querystring)* |
|
|
| `date` | A string representing a date formatted in ISO8601 or a number representing milliseconds since the epoch *(used only in ML)* |
|
|
| `time` | A numeric or string value representing duration |
|
|
| `string` | A string value |
|
|
| `enum` | A set of named constants *(a single value should be sent in the querystring)* |
|
|
| `int` | A signed 32-bit integer with a minimum value of -2<sup>31</sup> and a maximum value of 2<sup>31</sup>-1. |
|
|
| `double` | A [double-precision 64-bit IEEE 754](https://en.wikipedia.org/wiki/Floating-point_arithmetic) floating point number, restricted to finite values. |
|
|
| `long` | A signed 64-bit integer with a minimum value of -2<sup>63</sup> and a maximum value of 2<sup>63</sup>-1. *(Note: the max safe integer for JSON is 2<sup>53</sup>-1)* |
|
|
| `number` | Alias for `double`. *(deprecated, a more specific type should be used)* |
|
|
| `boolean` | Boolean fields accept JSON true and false values |
|
|
|
|
## Backwards compatibility
|
|
|
|
The specification follows the same backward compatibility guarantees as Elasticsearch.
|
|
|
|
- Within a Major, additions only.
|
|
- If an item has been documented wrong it should be deprecated instead as removing these might break downstream clients.
|
|
- Major version change, may deprecate pieces or simply remove them given enough deprecation time.
|
|
|
|
## Deprecations
|
|
|
|
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.
|
|
|
|
#### Entire API:
|
|
|
|
```json
|
|
{
|
|
"api" : {
|
|
"deprecated" : {
|
|
"version" : "7.0.0",
|
|
"description" : "Reason API is being deprecated"
|
|
},
|
|
}
|
|
}
|
|
```
|
|
|
|
#### Specific paths and their parts:
|
|
|
|
```json
|
|
{
|
|
"api": {
|
|
"url": {
|
|
"paths": [
|
|
{
|
|
"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"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
```json
|
|
{
|
|
"api": {
|
|
"url": {
|
|
"params": {
|
|
"stored_fields": {
|
|
"type": "list",
|
|
"description" : "",
|
|
"deprecated" : {
|
|
"version" : "7.0.0",
|
|
"description" : "Reason parameter is being deprecated"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## License
|
|
|
|
This software is dual licensed under the Server Side Public License, v 1 ("SSPL-1.0") and Elastic License 2.0.
|