Skip to content

Fix docs #796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/authentication.asciidoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[[auth-reference]]
== Authentication

This document contains code snippets to show you how to connect to various Elasticsearch providers.
Expand Down
1 change: 1 addition & 0 deletions docs/breaking-changes.asciidoc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/child.asciidoc
Original file line number Diff line number Diff line change
@@ -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. +
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.asciidoc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/extend.asciidoc
Original file line number Diff line number Diff line change
@@ -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. +
Expand Down
1 change: 1 addition & 0 deletions docs/introduction.asciidoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[[introduction]]
== Introduction

The official Node.js client for Elasticsearch.
Expand Down
1 change: 1 addition & 0 deletions docs/reference.asciidoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[[api-reference]]
== API Reference

////////
Expand Down
1 change: 1 addition & 0 deletions docs/typescript.asciidoc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/usage.asciidoc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 13 additions & 1 deletion scripts/utils/generateDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const dedent = require('dedent')

function generateDocs (common, spec) {
var doc = dedent`
[[api-reference]]
== API Reference

////////
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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':
Expand Down