Follow up of https://github.com/elastic/docs/pull/701.
This commit is contained in:
Tomas Della Vedova
2019-03-28 17:34:45 +01:00
committed by delvedor
parent 516139c48e
commit 45744762d3
10 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,4 @@
[[auth-reference]]
== Authentication
This document contains code snippets to show you how to connect to various Elasticsearch providers.

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
[[introduction]]
== Introduction
The official Node.js client for Elasticsearch.

View File

@ -1,3 +1,4 @@
[[api-reference]]
== API Reference
////////

View File

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

View File

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

View File

@ -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':