(cherry picked from commit e502d2f17a)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
This commit is contained in:
committed by
GitHub
parent
177a420521
commit
75f31d974d
@ -167,19 +167,11 @@ const client = new Client({
|
|||||||
----
|
----
|
||||||
|
|
||||||
|`nodeFilter`
|
|`nodeFilter`
|
||||||
a|`function` - Filters which node not to use for a request. +
|
a|`function` - Takes a `Connection` and returns `true` if it can be sent a request, otherwise `false`. +
|
||||||
_Default:_
|
_Default:_
|
||||||
[source,js]
|
[source,js]
|
||||||
----
|
----
|
||||||
function defaultNodeFilter (node) {
|
() => true
|
||||||
// avoid master only nodes
|
|
||||||
if (node.roles.master === true &&
|
|
||||||
node.roles.data === false &&
|
|
||||||
node.roles.ingest === false) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|`nodeSelector`
|
|`nodeSelector`
|
||||||
|
|||||||
@ -78,13 +78,6 @@ export interface NodeOptions {
|
|||||||
ssl?: TlsConnectionOptions
|
ssl?: TlsConnectionOptions
|
||||||
/** @property headers Custom HTTP headers that should be sent with each request */
|
/** @property headers Custom HTTP headers that should be sent with each request */
|
||||||
headers?: Record<string, any>
|
headers?: Record<string, any>
|
||||||
/** @property roles Common Elasticsearch roles that can be assigned to this node. Can be helpful when writing custom nodeFilter or nodeSelector functions. */
|
|
||||||
roles?: {
|
|
||||||
master: boolean
|
|
||||||
data: boolean
|
|
||||||
ingest: boolean
|
|
||||||
ml: boolean
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClientOptions {
|
export interface ClientOptions {
|
||||||
|
|||||||
Reference in New Issue
Block a user