2019-04-18 02:40:32 +02:00
A mini utility to convert [Elasticsearch's REST spec ](https://github.com/elastic/elasticsearch/blob/master/rest-api-spec ) to Console's (Kibana) autocomplete format.
It is used to semi-manually update Console's autocompletion rules.
2019-07-02 18:33:27 +02:00
### Retrieving the spec
2019-04-18 02:40:32 +02:00
2019-07-02 18:33:27 +02:00
If you don't have a copy of the Elasticsearch repo on your machine, follow these steps to clone only the rest API specs
2019-04-18 02:40:32 +02:00
```
2019-07-02 18:33:27 +02:00
mkdir es-spec & & cd es-spec
2019-04-18 02:40:32 +02:00
git init
git remote add origin https://github.com/elastic/elasticsearch
git config core.sparsecheckout true
2019-07-02 18:33:27 +02:00
echo "rest-api-spec/src/main/resources/rest-api-spec/api/*\nx-pack/plugin/src/test/resources/rest-api-spec/api/*" > .git/info/sparse-checkout
2019-04-18 02:40:32 +02:00
git pull --depth=1 origin master
```
### Usage
2019-07-02 18:33:27 +02:00
You need to run the command twice: once for the **OSS** specs and once for the **X-Pack** specs
At the root of the Kibana repository, run the following commands:
```sh
# OSS
2020-07-26 16:04:09 +02:00
yarn spec_to_console -g "< ELASTICSEARCH-REPO-FOLDER > /rest-api-spec/src/main/resources/rest-api-spec/api/*" -d "src/plugins/console/server/lib/spec_definitions/json/generated"
2019-07-02 18:33:27 +02:00
# X-pack
2020-07-26 16:04:09 +02:00
yarn spec_to_console -g "< ELASTICSEARCH-REPO-FOLDER > /x-pack/plugin/src/test/resources/rest-api-spec/api/*" -d "x-pack/plugins/console_extensions/server/lib/spec_definitions/json/generated"
2019-04-18 02:40:32 +02:00
```
### Information used in Console that is not available in the REST spec
2019-07-02 18:33:27 +02:00
2019-04-18 02:40:32 +02:00
* Request bodies
* Data fetched at runtime: indices, fields, snapshots, etc
* Ad hoc additions