Skip to content

Commit f93bbcc

Browse files
committed
Updated API reference doc (#945)
* Updated API reference doc * Updated docs script
1 parent a649c17 commit f93bbcc

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

docs/reference.asciidoc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
[[api-reference]]
22
== API Reference
33

4+
This document contains the entire list of the Elasticsearch API supported by the client, both OSS and commercial. The client is entirely licensed under Apache 2.0.
5+
6+
Elasticsearch exposes an HTTP layer to communicate with, and the client is a library that will help you do this. Because of this reason, you will see HTTP related parameters, such as `body` or `headers`.
7+
8+
Every API can accept two objects, the first contains all the parameters that will be sent to Elasticsearch, while the second includes the request specific parameters, such as timeouts, headers, and so on.
9+
In the first object, every parameter but the body will be sent via querystring or url parameter, depending on the API, and every unrecognized parameter will be sent as querystring.
10+
11+
[source,js]
12+
----
13+
// promise API
14+
const result = await client.search({
15+
index: 'my-index',
16+
from: 20,
17+
size: 10,
18+
body: { foo: 'bar' }
19+
}, {
20+
ignore: [404],
21+
maxRetries: 3
22+
})
23+
24+
// calback API
25+
client.search({
26+
index: 'my-index',
27+
from: 20,
28+
size: 10,
29+
body: { foo: 'bar' }
30+
}, {
31+
ignore: [404],
32+
maxRetries: 3
33+
}, (err, result) => {
34+
if (err) console.log(err)
35+
})
36+
----
37+
38+
In this document, you will find the reference of every parameter accepted by the querystring or the url. If you also need to send the body, you can find the documentation of its format in the reference link that is present along with every endpoint.
39+
440
////////
541
642
This documentation is generated by running:

scripts/utils/generateDocs.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,42 @@ function generateDocs (common, spec) {
1111
[[api-reference]]
1212
== API Reference
1313
14+
This document contains the entire list of the Elasticsearch API supported by the client, both OSS and commercial. The client is entirely licensed under Apache 2.0.
15+
16+
Elasticsearch exposes an HTTP layer to communicate with, and the client is a library that will help you do this. Because of this reason, you will see HTTP related parameters, such as ${'`'}body${'`'} or ${'`'}headers${'`'}.
17+
18+
Every API can accept two objects, the first contains all the parameters that will be sent to Elasticsearch, while the second includes the request specific parameters, such as timeouts, headers, and so on.
19+
In the first object, every parameter but the body will be sent via querystring or url parameter, depending on the API, and every unrecognized parameter will be sent as querystring.
20+
21+
[source,js]
22+
----
23+
// promise API
24+
const result = await client.search({
25+
index: 'my-index',
26+
from: 20,
27+
size: 10,
28+
body: { foo: 'bar' }
29+
}, {
30+
ignore: [404],
31+
maxRetries: 3
32+
})
33+
34+
// calback API
35+
client.search({
36+
index: 'my-index',
37+
from: 20,
38+
size: 10,
39+
body: { foo: 'bar' }
40+
}, {
41+
ignore: [404],
42+
maxRetries: 3
43+
}, (err, result) => {
44+
if (err) console.log(err)
45+
})
46+
----
47+
48+
In this document, you will find the reference of every parameter accepted by the querystring or the url. If you also need to send the body, you can find the documentation of its format in the reference link that is present along with every endpoint.
49+
1450
////////
1551
1652
This documentation is generated by running:

0 commit comments

Comments
 (0)