Skip to content

Commit e98edff

Browse files
authored
Fix docs (#796)
Follow up of elastic/docs#701.
1 parent 22d65e5 commit e98edff

10 files changed

+22
-1
lines changed

docs/authentication.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[auth-reference]]
12
== Authentication
23

34
This document contains code snippets to show you how to connect to various Elasticsearch providers.

docs/breaking-changes.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[breaking-changes]]
12
== Breaking changes coming from the old client
23

34
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.

docs/child.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[child-client]]
12
== Creating a child client
23

34
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. +

docs/configuration.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[client-configuration]]
12
== Client configuration
23

34
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.

docs/extend.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[extend-client]]
12
== Extend the client
23

34
Sometimes you need to reuse the same logic, or you want to build a custom API to allow you simplify your code. +

docs/introduction.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[introduction]]
12
== Introduction
23

34
The official Node.js client for Elasticsearch.

docs/reference.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[api-reference]]
12
== API Reference
23

34
////////

docs/typescript.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[typescript]]
12
== TypeScript support
23

34
The client offers a first-class support for TypeScript, since it ships the type definitions for every exposed API.

docs/usage.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[client-usage]]
12
== Usage
23

34
Use the client is pretty straightforward, it supports all the public APIs of Elasticsearch, and every method exposes the same signature.

scripts/utils/generateDocs.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const dedent = require('dedent')
2323

2424
function generateDocs (common, spec) {
2525
var doc = dedent`
26+
[[api-reference]]
2627
== API Reference
2728
2829
////////
@@ -68,7 +69,7 @@ function commonParameters (spec) {
6869

6970
function generateApiDoc (spec) {
7071
const name = Object.keys(spec)[0]
71-
const documentationUrl = spec[name].documentation
72+
const documentationUrl = fixLink(spec[name].documentation)
7273
const params = []
7374
// url params
7475
const urlParts = spec[name].url.parts
@@ -139,6 +140,17 @@ function generateApiDoc (spec) {
139140
return doc
140141
}
141142

143+
// Fixes bad urls in the JSON spec
144+
function fixLink (str) {
145+
if (!str) return ''
146+
if (str.includes('/5.x/')) {
147+
// fixes wrong url in ES5
148+
str = str.replace(/5\.x/, '5.6')
149+
}
150+
151+
return str
152+
}
153+
142154
function getType (type, options) {
143155
switch (type) {
144156
case 'list':

0 commit comments

Comments
 (0)