You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration.asciidoc
+29-53Lines changed: 29 additions & 53 deletions
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,8 @@ WARNING: Due to the complex nature of the configuration, the config object you p
15
15
16
16
[[config-options]]
17
17
=== Config options
18
-
19
-
*`host or hosts`*[[config-hosts]]::
18
+
[horizontal]
19
+
`host or hosts`[[config-hosts]]::
20
20
`String, String[], Object[]` -- Specify the hosts that this client will connect to. If sniffing is enabled, or you call `client.sniff()`, this list will be used as seeds to discover the rest of your cluster.
21
21
+
22
22
The value(s) are passed to the <<host-reference,`Host`>> constructor. `Host` objects can help enforce path-prefixes, default headers and query strings, and can be helpful in making more intelligent selection algorithms; Head over to <<host-reference,the `Host` docs>> for more information.
@@ -29,10 +29,10 @@ Default:::
29
29
------
30
30
31
31
32
-
*`httpAuth`*[[config-http-auth]]:: `String` -- Specifies the default http auth as a String with username and password separated by a colon (eg. `user:pass`). Applies to any host defined in the original config, and any hosts discovered while sniffing.
32
+
`httpAuth`[[config-http-auth]]:: `String` -- Specifies the default http auth as a String with username and password separated by a colon (eg. `user:pass`). Applies to any host defined in the original config, and any hosts discovered while sniffing.
33
33
34
34
35
-
*`log`*[[config-log]]:: `String, String[], Object, Object[], Constructor` -- Unless a constructor is specified, this sets the output settings for the bundled logger. See the section on configuring-logging[logging] for more information.
35
+
`log`[[config-log]]:: `String, String[], Object, Object[], Constructor` -- Unless a constructor is specified, this sets the output settings for the bundled logger. See the section on configuring-logging[logging] for more information.
36
36
37
37
Default in Node:::
38
38
+
@@ -48,13 +48,14 @@ Default in Node:::
48
48
49
49
50
50
51
-
*`apiVersion`*[[config-api-version]]:: `String` -- Change the API that they client provides, specify the major version of the Elasticsearch nodes you will be connecting to.
51
+
`apiVersion`[[config-api-version]]:: `String` -- Change the API that they client provides, specify the major version of the Elasticsearch nodes you will be connecting to.
52
52
+
53
53
WARNING: This default will track the latest version of Elasticsearch, and is only intended to be used during development. It is highly recommended that you set this parameter in all code that is headed to production.
54
54
55
-
Default ::: `'6.4'`
55
+
Default ::: `'6.5'`
56
56
57
57
Options in node :::
58
+
* `'6.6'`
58
59
* `'6.5'`
59
60
* `'6.4'`
60
61
* `'6.3'`
@@ -75,17 +76,17 @@ Options in node :::
75
76
* `'master'` (unstable)
76
77
77
78
Options in the browser :::
79
+
* `'6.6'`
78
80
* `'6.5'`
79
81
* `'6.4'`
80
82
* `'6.3'`
81
83
* `'6.2'`
82
-
* `'6.1'`
83
84
* `'6.x'` (unstable)
84
85
* `'master'` (unstable)
85
86
86
87
87
88
88
-
*`plugins`*[[config-plugins]]:: `Function[]` -- Plugin instantiators that will be called when the Client initializes. Each function is called in order with the arguments `Constructor`, `config`, and `components`.
89
+
`plugins`[[config-plugins]]:: `Function[]` -- Plugin instantiators that will be called when the Client initializes. Each function is called in order with the arguments `Constructor`, `config`, and `components`.
89
90
+
90
91
`Constructor` is the class that will be newed up to create the client instance. It's prototype contains the api methods that correlate to the `apiVersion` requested.
91
92
+
@@ -94,86 +95,86 @@ Options in the browser :::
94
95
`components` is a map of the internal classes for this version of the elasticsearch client. The values on this object are listed https://github.com/elastic/elasticsearch-js/blob/master/src/lib/client.js#L80[here].
95
96
96
97
97
-
*`sniffOnStart`*[[config-sniff-on-start]]:: `Boolean` -- Should the client attempt to detect the rest of the cluster when it is first instantiated?
98
+
`sniffOnStart`[[config-sniff-on-start]]:: `Boolean` -- Should the client attempt to detect the rest of the cluster when it is first instantiated?
98
99
99
100
Default::: `false`
100
101
101
102
102
103
103
104
104
105
105
-
*`sniffInterval`*[[config-sniff-interval]]:: `Number, false` -- Every `n` milliseconds, perform a sniff operation and make sure our list of nodes is complete.
106
+
`sniffInterval`[[config-sniff-interval]]:: `Number, false` -- Every `n` milliseconds, perform a sniff operation and make sure our list of nodes is complete.
106
107
107
108
Default::: `false`
108
109
109
110
110
111
111
112
112
113
113
-
*`sniffOnConnectionFault`*[[config-sniff-on-connection-fault]]:: `Boolean` -- Should the client immediately sniff for a more current list of nodes when a connection dies?
114
+
`sniffOnConnectionFault`[[config-sniff-on-connection-fault]]:: `Boolean` -- Should the client immediately sniff for a more current list of nodes when a connection dies?
114
115
115
116
Default::: `false`
116
117
117
118
118
119
119
120
120
-
*`maxRetries`*[[config-max-retries]]:: `Integer` -- How many times should the client try to connect to other nodes before returning a <<connection-fault,ConnectionFault>> error.
121
+
`maxRetries`[[config-max-retries]]:: `Integer` -- How many times should the client try to connect to other nodes before returning a <<connection-fault,ConnectionFault>> error.
121
122
122
123
Default::: `3`
123
124
124
125
125
126
126
127
127
128
128
-
*`requestTimeout`*[[config-request-timeout]]:: `Number` -- Milliseconds before an HTTP request will be aborted and retried. This can also be set per request.
129
+
`requestTimeout`[[config-request-timeout]]:: `Number` -- Milliseconds before an HTTP request will be aborted and retried. This can also be set per request.
129
130
130
131
Default::: `30000`
131
132
132
133
133
134
134
135
135
136
136
-
*`deadTimeout`*[[config-dead-timeout]]:: `Number` -- Milliseconds that a dead connection will wait before attempting to revive itself.
137
+
`deadTimeout`[[config-dead-timeout]]:: `Number` -- Milliseconds that a dead connection will wait before attempting to revive itself.
137
138
138
139
Default::: `60000`
139
140
140
141
141
-
*`pingTimeout`*[[config-ping-timeout]]:: `Number` -- Milliseconds that a ping request can take before timing out.
142
+
`pingTimeout`[[config-ping-timeout]]:: `Number` -- Milliseconds that a ping request can take before timing out.
142
143
143
144
Default::: `3000`
144
145
145
146
146
-
*`maxSockets`*[[config-keep-alive-max-sockets]]:: `Number` -- Maximum number of sockets to allow per host.
147
+
`maxSockets`[[config-keep-alive-max-sockets]]:: `Number` -- Maximum number of sockets to allow per host.
147
148
148
149
Default::: `Infinity`
149
150
150
151
151
-
*`keepAlive`*[[config-keep-alive]]:: `Boolean` -- Should the connections to the node be kept open forever? This behavior is recommended when you are connecting directly to Elasticsearch.
152
+
`keepAlive`[[config-keep-alive]]:: `Boolean` -- Should the connections to the node be kept open forever? This behavior is recommended when you are connecting directly to Elasticsearch.
152
153
153
154
Default::: `true`
154
155
155
156
156
-
*`keepAliveInterval`*[[config-keep-alive-interval]]:: `Number` -- How often, in milliseconds, should TCP KeepAlive packets be sent over sockets being kept alive. Only relevant if `keepAlive` is set to `true`.
157
+
`keepAliveInterval`[[config-keep-alive-interval]]:: `Number` -- How often, in milliseconds, should TCP KeepAlive packets be sent over sockets being kept alive. Only relevant if `keepAlive` is set to `true`.
157
158
158
159
Default::: `1000`
159
160
160
161
161
-
*`keepAliveMaxFreeSockets`*[[config-keep-alive-max-free-sockets]]:: `Number` -- Maximum number of inactive sockets to keep connected to a node. Only relevant if `keepAlive` is set to `true`.
162
+
`keepAliveMaxFreeSockets`[[config-keep-alive-max-free-sockets]]:: `Number` -- Maximum number of inactive sockets to keep connected to a node. Only relevant if `keepAlive` is set to `true`.
162
163
163
164
Default::: `256`
164
165
165
166
166
-
*`keepAliveFreeSocketTimeout`*[[config-keep-alive-free-socket-timeout]]:: `Number` -- Sets inactive sockets to timeout after milliseconds of inactivity. Only relevant if `keepAlive` is set to `true`.
167
+
`keepAliveFreeSocketTimeout`[[config-keep-alive-free-socket-timeout]]:: `Number` -- Sets inactive sockets to timeout after milliseconds of inactivity. Only relevant if `keepAlive` is set to `true`.
167
168
168
169
Default::: `60000`
169
170
170
171
171
-
*`suggestCompression`*[[config-suggest-compression]]:: `Boolean` -- The client should inform Elasticsearch, on each request, that it can accept compressed responses. In order for the responses to actually be compressed, you must enable `http.compression` in Elasticsearch. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-http.html[these docs] for additional info.
172
+
`suggestCompression`[[config-suggest-compression]]:: `Boolean` -- The client should inform Elasticsearch, on each request, that it can accept compressed responses. In order for the responses to actually be compressed, you must enable `http.compression` in Elasticsearch. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-http.html[these docs] for additional info.
172
173
173
174
Default::: `false`
174
175
175
176
176
-
*`connectionClass`*[[config-connection-class]]:: `String, Constructor` -- Defines the class that will be used to create connections to store in the connection pool. If you are looking to implement additional protocols you should probably start by writing a Connection class that extends the ConnectionAbstract.
177
+
`connectionClass`[[config-connection-class]]:: `String, Constructor` -- Defines the class that will be used to create connections to store in the connection pool. If you are looking to implement additional protocols you should probably start by writing a Connection class that extends the ConnectionAbstract.
177
178
178
179
Defaults:::
179
180
* Node: `"http"`
@@ -182,12 +183,12 @@ Defaults:::
182
183
* jQuery Build: `"jquery"`
183
184
184
185
185
-
*`sniffedNodesProtocol`*[[config-sniffed-nodes-protocol]]:: `String` -- Defines the protocol that will be used to communicate with nodes discovered during sniffing.
186
+
`sniffedNodesProtocol`[[config-sniffed-nodes-protocol]]:: `String` -- Defines the protocol that will be used to communicate with nodes discovered during sniffing.
186
187
187
188
Default::: If all of the hosts/host passed to the client via configuration use the same protocol then this defaults to that protocol, otherwise it defaults to `"http"`.
188
189
189
190
190
-
*`ssl`*[[config-ssl]]:: `Object` -- An object defining HTTPS/SSL configuration to use for all nodes. The properties of this mimic the options accepted by http://nodejs.org/docs/latest/api/tls.html#tls_tls_connect_port_host_options_callback[`tls.connect()`] with the exception of `rejectUnauthorized`, which defaults to `false` allowing self-signed certificates to work out-of-the-box.
191
+
`ssl`[[config-ssl]]:: `Object` -- An object defining HTTPS/SSL configuration to use for all nodes. The properties of this mimic the options accepted by http://nodejs.org/docs/latest/api/tls.html#tls_tls_connect_port_host_options_callback[`tls.connect()`] with the exception of `rejectUnauthorized`, which defaults to `false` allowing self-signed certificates to work out-of-the-box.
191
192
+
192
193
Additional information available in <<auth-reference>>.
193
194
@@ -217,7 +218,7 @@ var client = new elasticsearch.Client({
217
218
-----
218
219
219
220
220
-
*`selector`*[[config-selector]]:: `String, Function` -- This function will be used to select a connection from the ConnectionPool. It should received a single argument, the list of "active" connections, and return the connection to use. Use this selector to implement special logic for your client such as preferring nodes in a certain rack or data-center.
221
+
`selector`[[config-selector]]:: `String, Function` -- This function will be used to select a connection from the ConnectionPool. It should received a single argument, the list of "active" connections, and return the connection to use. Use this selector to implement special logic for your client such as preferring nodes in a certain rack or data-center.
221
222
+
222
223
To make this function asynchronous, accept a second argument which will be the callback to use. The callback should be called Node-style with a possible error like: `cb(err, selectedConnection)`.
223
224
@@ -231,7 +232,7 @@ Options:::
231
232
232
233
233
234
234
-
*`defer`*[[config-defer]]:: `Function` -- Override the way that the client creates promises. If you would rather use any other promise library this is how you'd do that. Elasticsearch.js expects that the defer object has a `promise` property (which will be returned to promise consumers), as well as `resolve` and `reject` methods.
235
+
`defer`[[config-defer]]:: `Function` -- Override the way that the client creates promises. If you would rather use any other promise library this is how you'd do that. Elasticsearch.js expects that the defer object has a `promise` property (which will be returned to promise consumers), as well as `resolve` and `reject` methods.
235
236
236
237
Default::: Defer object created with ES6 Promise
237
238
@@ -249,15 +250,15 @@ var client = new elasticsearch.Client({
249
250
250
251
251
252
252
-
*`nodesToHostCallback`*[[config-nodes-to-host-callback]]:: `Function` - This function will receive the list of nodes returned from the `_cluster/nodes` API during a sniff operation. The function should return an array of objects which match the <<config-hosts,specification for the `hosts` config>>.
253
+
`nodesToHostCallback`[[config-nodes-to-host-callback]]:: `Function` - This function will receive the list of nodes returned from the `_cluster/nodes` API during a sniff operation. The function should return an array of objects which match the <<config-hosts,specification for the `hosts` config>>.
253
254
254
255
Default:::
255
256
see https://github.com/elasticsearch/elasticsearch-js/blob/master/src/lib/nodes_to_host.js[nodes_to_host.js]
256
257
257
258
258
259
259
260
260
-
*`createNodeAgent`*[[config-create-node-agent]]:: `Function` -- Override the way that the client creates node.js `Agent`[https://nodejs.org/api/http.html#http_class_http_agent] objects. The value of this property will be executed every time a new Node is added to the client (either from the initial seed or from sniffing) and can return any value that node's http(s) module accepts as `agent:` configuration.
261
+
`createNodeAgent`[[config-create-node-agent]]:: `Function` -- Override the way that the client creates node.js `Agent`[https://nodejs.org/api/http.html#http_class_http_agent] objects. The value of this property will be executed every time a new Node is added to the client (either from the initial seed or from sniffing) and can return any value that node's http(s) module accepts as `agent:` configuration.
261
262
+
262
263
The function is called with two arguments, first an `HttpConnector`[http://github.com/spalger/elasticsearch-js/blob/master/src/lib/connectors/http.js] object and the second the config object initially passed when creating the client.
263
264
@@ -276,31 +277,6 @@ var client = new elasticsearch.Client({
276
277
277
278
278
279
279
-
*`serializer`*[[config-serializer]]:: `Serializer` -- Override the way that the client serializes the JSON payload sent to elasticsearch. This can be useful if you're using a third party library that needs to convert to "plain" JS objects, such as with https://github.com/elastic/elasticsearch-js/blob/master/src/lib/serializers/angular.js[angular.js]. Another helpful use case is in an advanced scenario where your application assembles queries dynamically. Using a stable stringify in that case ensures property order to prevent cache misses (as outlined in https://github.com/elastic/elasticsearch-js/issues/695[GH Issue 695]).
280
-
281
-
Default::: see https://github.com/elastic/elasticsearch-js/blob/master/src/lib/serializers/json.js[json.js]
282
-
283
-
To Use Stable Stringification:::
284
-
+
285
-
[source,js]
286
-
-----
287
-
import DefaultJsonSerializer from 'elasticsearch/src/lib/serializers/json';
288
-
import jsonStableStringify from 'json-stable-stringify';
289
-
290
-
class CustomSerializer extends DefaultJsonSerializer {
291
-
serialize(val, replacer, space) {
292
-
return jsonStableStringify(val, { replacer, space })
0 commit comments