280 lines
9.2 KiB
HTML
280 lines
9.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>src/api/cluster/node_info.js - elasticsearch-js</title>
|
|
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
|
<link rel="stylesheet" href="../assets/vendor/bootstrap/css/bootstrap.css">
|
|
<link rel="stylesheet" href="../assets/vendor/bootstrap/css/bootstrap-responsive.css">
|
|
<link rel="stylesheet" href="../assets/css/main.css">
|
|
<link rel="shortcut icon" type="image/png" href="../assets/img/favicon.png">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-default" role="navigation">
|
|
<!-- Brand and toggle get grouped for better mobile display -->
|
|
<a class="navbar-brand" href="#">elasticsearch-js</a>
|
|
<p class="navbar-text">
|
|
API Docs for Version: <b>0.0.1</b>
|
|
</p>
|
|
|
|
<form class="navbar-form navbar-right visible-md visible-large" role="search">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" placeholder="Search">
|
|
</div>
|
|
</form>
|
|
</nav>
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div>
|
|
<h3>APIs</h3>
|
|
<div id="sidebar">
|
|
<ul id="main-nav" class="nav nav-tabs" style="margin-bottom:0;">
|
|
|
|
<li class="active" style="visibility:hidden;"><a>just classes</a></li>
|
|
|
|
</ul>
|
|
|
|
<div id="api-tabview-filter">
|
|
<input type="search" placeholder="Type to filter APIs">
|
|
</div>
|
|
|
|
<div class="tab-content" style="border: 1px solid #DDD; border-top:0;">
|
|
<div class="tab-pane active" id="classes">
|
|
<ul id="api-classes" class="nav nav-list">
|
|
|
|
<li><a href="../classes/Client.html">Client</a></li>
|
|
|
|
<li><a href="../classes/ConnectionPool.html">ConnectionPool</a></li>
|
|
|
|
<li><a href="../classes/jQueryXhr.html">jQueryXhr</a></li>
|
|
|
|
<li><a href="../classes/Log.html">Log</a></li>
|
|
|
|
<li><a href="../classes/Loggers.File.html">Loggers.File</a></li>
|
|
|
|
<li><a href="../classes/Loggers.Stdio.html">Loggers.Stdio</a></li>
|
|
|
|
<li><a href="../classes/Loggers.Stream.html">Loggers.Stream</a></li>
|
|
|
|
<li><a href="../classes/NodeHttp.html">NodeHttp</a></li>
|
|
|
|
<li><a href="../classes/Transport.html">Transport</a></li>
|
|
|
|
<li><a href="../classes/utils.html">utils</a></li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="col-md-9">
|
|
|
|
<div id="docs-main">
|
|
<div class="content">
|
|
<div class="page-header">
|
|
<h1>src/api/cluster/node_info.js <small>File</small></h1>
|
|
</div>
|
|
|
|
<div class="file">
|
|
<pre class="prettyprint linenums">
|
|
var _ = require('../../lib/utils');
|
|
|
|
//TODO: this enpoint ***needs*** work, many of the possible urls are not supported
|
|
|
|
|
|
/**
|
|
* Perform an elasticsearch [cluster.node_info](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/) request
|
|
*
|
|
* @for Client
|
|
* @method cluster.node_info
|
|
* @param {Object} params - An object with parameters used to carry out this action
|
|
* @param {boolean} params.all - Return all available information
|
|
* @param {boolean} params.clear - Reset the default settings
|
|
* @param {boolean} params.http - Return information about HTTP
|
|
* @param {boolean} params.jvm - Return information about the JVM
|
|
* @param {boolean} params.network - Return information about network
|
|
* @param {boolean} params.os - Return information about the operating system
|
|
* @param {boolean} params.plugin - Return information about plugins
|
|
* @param {boolean} params.process - Return information about the Elasticsearch process
|
|
* @param {boolean} params.settings - Return information about node settings
|
|
* @param {boolean} params.thread_pool - Return information about the thread pool
|
|
* @param {Date|Number} params.timeout - Explicit operation timeout
|
|
* @param {boolean} params.transport - Return information about transport
|
|
*/
|
|
function doClusterNodeInfo(params) {
|
|
var request = {}
|
|
, url = {}
|
|
, query = {};
|
|
|
|
params = params || {};
|
|
|
|
request.method = 'GET';
|
|
|
|
// find the url's params
|
|
if (params.hasOwnProperty('node_id')) {
|
|
if (typeof params.node_id === 'string') {
|
|
url.node_id = params.node_id;
|
|
} else if (_.isArray(params.node_id)) {
|
|
url.node_id = params.node_id.join(',');
|
|
} else {
|
|
throw new TypeError('Invalid node_id:' + params.node_id + ' should be a comma seperated list or array.');
|
|
}
|
|
}
|
|
|
|
|
|
// build the url
|
|
if (url.hasOwnProperty('node_id')) {
|
|
request.url = '/_nodes/' + url.node_id + '';
|
|
}
|
|
else {
|
|
request.url = '/_nodes';
|
|
}
|
|
|
|
|
|
// build the query string
|
|
if (params.hasOwnProperty('all')) {
|
|
if (params.all.toLowerCase && (params.all = params.all.toLowerCase())
|
|
&& (params.all === 'no' || params.all === 'off')
|
|
) {
|
|
query.all = false;
|
|
} else {
|
|
query.all = !!params.all;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('clear')) {
|
|
if (params.clear.toLowerCase && (params.clear = params.clear.toLowerCase())
|
|
&& (params.clear === 'no' || params.clear === 'off')
|
|
) {
|
|
query.clear = false;
|
|
} else {
|
|
query.clear = !!params.clear;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('http')) {
|
|
if (params.http.toLowerCase && (params.http = params.http.toLowerCase())
|
|
&& (params.http === 'no' || params.http === 'off')
|
|
) {
|
|
query.http = false;
|
|
} else {
|
|
query.http = !!params.http;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('jvm')) {
|
|
if (params.jvm.toLowerCase && (params.jvm = params.jvm.toLowerCase())
|
|
&& (params.jvm === 'no' || params.jvm === 'off')
|
|
) {
|
|
query.jvm = false;
|
|
} else {
|
|
query.jvm = !!params.jvm;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('network')) {
|
|
if (params.network.toLowerCase && (params.network = params.network.toLowerCase())
|
|
&& (params.network === 'no' || params.network === 'off')
|
|
) {
|
|
query.network = false;
|
|
} else {
|
|
query.network = !!params.network;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('os')) {
|
|
if (params.os.toLowerCase && (params.os = params.os.toLowerCase())
|
|
&& (params.os === 'no' || params.os === 'off')
|
|
) {
|
|
query.os = false;
|
|
} else {
|
|
query.os = !!params.os;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('plugin')) {
|
|
if (params.plugin.toLowerCase && (params.plugin = params.plugin.toLowerCase())
|
|
&& (params.plugin === 'no' || params.plugin === 'off')
|
|
) {
|
|
query.plugin = false;
|
|
} else {
|
|
query.plugin = !!params.plugin;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('process')) {
|
|
if (params.process.toLowerCase && (params.process = params.process.toLowerCase())
|
|
&& (params.process === 'no' || params.process === 'off')
|
|
) {
|
|
query.process = false;
|
|
} else {
|
|
query.process = !!params.process;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('settings')) {
|
|
if (params.settings.toLowerCase && (params.settings = params.settings.toLowerCase())
|
|
&& (params.settings === 'no' || params.settings === 'off')
|
|
) {
|
|
query.settings = false;
|
|
} else {
|
|
query.settings = !!params.settings;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('thread_pool')) {
|
|
if (params.thread_pool.toLowerCase && (params.thread_pool = params.thread_pool.toLowerCase())
|
|
&& (params.thread_pool === 'no' || params.thread_pool === 'off')
|
|
) {
|
|
query.thread_pool = false;
|
|
} else {
|
|
query.thread_pool = !!params.thread_pool;
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('timeout')) {
|
|
if (params.timeout instanceof Date) {
|
|
query.timeout = params.timeout.getTime();
|
|
} else if (_.isNumeric(params.timeout)) {
|
|
query.timeout = params.timeout;
|
|
} else {
|
|
throw new TypeError('Invalid timeout:' + params.timeout + ' should be be some sort of time.');
|
|
}
|
|
}
|
|
|
|
if (params.hasOwnProperty('transport')) {
|
|
if (params.transport.toLowerCase && (params.transport = params.transport.toLowerCase())
|
|
&& (params.transport === 'no' || params.transport === 'off')
|
|
) {
|
|
query.transport = false;
|
|
} else {
|
|
query.transport = !!params.transport;
|
|
}
|
|
}
|
|
|
|
request.url = request.url + _.makeQueryString(query);
|
|
|
|
return this.client.request(request);
|
|
}
|
|
|
|
module.exports = doClusterNodeInfo;
|
|
</pre>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="../assets/vendor/jquery/jquery-1.10.2.min.js"></script>
|
|
<script src="../assets/vendor/bootstrap/js/bootstrap.js"></script>
|
|
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
|
<script src="../assets/js/main.js"></script>
|
|
</body>
|
|
</html>
|