added docs related to extending the API, and included the transport page in the index so that it is listed online
This commit is contained in:
@ -119,6 +119,37 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
`nodeId`::
|
||||
`String, String[], Boolean` -- A comma-separated list of node IDs or names to limit the returned information
|
||||
|
||||
[[api-cat-count]]
|
||||
=== `cat.count`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.cat.count([params, [callback]])
|
||||
--------
|
||||
|
||||
// no description
|
||||
|
||||
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-count.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
`index`::
|
||||
`String, String[], Boolean` -- A comma-separated list of index names to limit the returned information
|
||||
|
||||
[[api-cat-health]]
|
||||
=== `cat.health`
|
||||
|
||||
@ -145,6 +176,8 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`[ts=true]`::
|
||||
`Boolean` -- Set to false to disable timestamping
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
|
||||
@ -197,6 +230,8 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`pri`::
|
||||
`Boolean` -- Set to true to return stats only for primary shards
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
`index`::
|
||||
@ -289,6 +324,39 @@ The default method is `GET` and the usual <<api-conventions,params and return va
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
|
||||
[[api-cat-recovery]]
|
||||
=== `cat.recovery`
|
||||
|
||||
[source,js]
|
||||
--------
|
||||
client.cat.recovery([params, [callback]])
|
||||
--------
|
||||
|
||||
// no description
|
||||
|
||||
The default method is `GET` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-recovery.html[the elasticsearch docs] for more about this method.
|
||||
|
||||
// no examples
|
||||
|
||||
|
||||
==== Params
|
||||
|
||||
[horizontal]
|
||||
`bytes`::
|
||||
`String` -- The unit in which to display byte values
|
||||
`local`::
|
||||
`Boolean` -- Return local information, do not retrieve the state from master node (default: false)
|
||||
`masterTimeout`::
|
||||
`Date, Number` -- Explicit operation timeout for connection to master node
|
||||
`h`::
|
||||
`String, String[], Boolean` -- Comma-separated list of column names to display
|
||||
`help`::
|
||||
`Boolean` -- Return help information
|
||||
`v`::
|
||||
`Boolean` -- Verbose mode. Display column headers
|
||||
`index`::
|
||||
`String, String[], Boolean` -- A comma-separated list of index names to limit the returned information
|
||||
|
||||
[[api-cat-shards]]
|
||||
=== `cat.shards`
|
||||
|
||||
|
||||
@ -12,6 +12,21 @@ Coming Soon
|
||||
see <<logging>>.
|
||||
|
||||
=== Client/API
|
||||
The Client's only real purpose (as you may be able to tell from client.js) is to hold the API methods, set a few default values, and instantiate the transport. The transport is where all the networking, retry, and cluster discovery takes place and including it in your client is as simple as `transport = new es.Transport({});`. This way, you can benefit from the core features of our client.
|
||||
Extending or replacing the API that Elasticsearch.js provides is a simple as it should be in JS. To provide an entirely new API, just add it to the Client constructor's `api` property like so:
|
||||
|
||||
NOTE: In the near future the entire transport level will be abstracted into a separate module, as well as the API.
|
||||
[source,js]
|
||||
--------------
|
||||
var myApi = {
|
||||
getDog: function () { ... }
|
||||
};
|
||||
|
||||
elasticsearch.Client.apis.mine = myApi;
|
||||
|
||||
var client = new elasticsearch.Client({
|
||||
apiVersion: 'mine'
|
||||
});
|
||||
|
||||
client.getDog( ... );
|
||||
--------------
|
||||
|
||||
When the client is created, it's prototype is set to the API version selected, and therefore you can access the client via the `this` variable within your API methods. Make requests within your methods using `this.transport.request(params, cb)`. For more information about the transport, see <<transport-reference>>.
|
||||
@ -18,4 +18,6 @@ include::logging.asciidoc[]
|
||||
|
||||
include::development.asciidoc[]
|
||||
|
||||
include::errors.asciidoc[]
|
||||
include::errors.asciidoc[]
|
||||
|
||||
include::transport.asciidoc[]
|
||||
Reference in New Issue
Block a user