diff --git a/docs/authentication.asciidoc b/docs/authentication.asciidoc index bf75e5644..bd6a0fa30 100644 --- a/docs/authentication.asciidoc +++ b/docs/authentication.asciidoc @@ -1,3 +1,4 @@ +[[auth-reference]] == Authentication This document contains code snippets to show you how to connect to various Elasticsearch providers. diff --git a/docs/breaking-changes.asciidoc b/docs/breaking-changes.asciidoc index 724f6ed56..c7ece5ac5 100644 --- a/docs/breaking-changes.asciidoc +++ b/docs/breaking-changes.asciidoc @@ -1,3 +1,4 @@ +[[breaking-changes]] == Breaking changes coming from the old client If you were already using the previous version of this client --i.e. the one you used to install with `npm install elasticsearch`-- you will encounter some breaking changes. diff --git a/docs/child.asciidoc b/docs/child.asciidoc index 2c58b013f..a86fded0a 100644 --- a/docs/child.asciidoc +++ b/docs/child.asciidoc @@ -1,3 +1,4 @@ +[[child-client]] == Creating a child client There are some use cases where you may need multiple instances of the client. You can easily do that by calling `new Client()` as many times as you need, but you will lose all the benefits of using one single client, such as the long living connections and the connection pool handling. + diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index 60bca53cd..3df5caafc 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -1,3 +1,4 @@ +[[client-configuration]] == Client configuration The client is designed to be easily configured as you see fit for your needs, following you can see all the possible basic options that you can use to configure it. diff --git a/docs/extend.asciidoc b/docs/extend.asciidoc index 0c246e53a..de62ddd6a 100644 --- a/docs/extend.asciidoc +++ b/docs/extend.asciidoc @@ -1,3 +1,4 @@ +[[extend-client]] == Extend the client Sometimes you need to reuse the same logic, or you want to build a custom API to allow you simplify your code. + diff --git a/docs/introduction.asciidoc b/docs/introduction.asciidoc index 5f0a2e73a..35bd75b3b 100644 --- a/docs/introduction.asciidoc +++ b/docs/introduction.asciidoc @@ -1,3 +1,4 @@ +[[introduction]] == Introduction The official Node.js client for Elasticsearch. diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 1ce137e78..5c9377cae 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1,3 +1,4 @@ +[[api-reference]] == API Reference //////// diff --git a/docs/typescript.asciidoc b/docs/typescript.asciidoc index 85f06d5b6..4dbe92054 100644 --- a/docs/typescript.asciidoc +++ b/docs/typescript.asciidoc @@ -1,3 +1,4 @@ +[[typescript]] == TypeScript support The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API. diff --git a/docs/usage.asciidoc b/docs/usage.asciidoc index ea0c39649..8065c120b 100644 --- a/docs/usage.asciidoc +++ b/docs/usage.asciidoc @@ -1,3 +1,4 @@ +[[client-usage]] == Usage Use the client is pretty straightforward, it supports all the public APIs of Elasticsearch, and every method exposes the same signature. diff --git a/scripts/utils/generateDocs.js b/scripts/utils/generateDocs.js index 49519ad9e..fc0dd8797 100644 --- a/scripts/utils/generateDocs.js +++ b/scripts/utils/generateDocs.js @@ -23,6 +23,7 @@ const dedent = require('dedent') function generateDocs (common, spec) { var doc = dedent` + [[api-reference]] == API Reference //////// @@ -68,7 +69,7 @@ function commonParameters (spec) { function generateApiDoc (spec) { const name = Object.keys(spec)[0] - const documentationUrl = spec[name].documentation + const documentationUrl = fixLink(spec[name].documentation) const params = [] // url params const urlParts = spec[name].url.parts @@ -139,6 +140,17 @@ function generateApiDoc (spec) { return doc } +// Fixes bad urls in the JSON spec +function fixLink (str) { + if (!str) return '' + if (str.includes('/5.x/')) { + // fixes wrong url in ES5 + str = str.replace(/5\.x/, '5.6') + } + + return str +} + function getType (type, options) { switch (type) { case 'list':