April 18, 2017 The watcher plugin has been replaced with X-Pack for some time and while there is no official X-Pack plugin for elasticsearch.js we will not be working on the elasticsearch-watcher module any more.
For people trying to integrate with X-Pack via the client, consider using the client.transport.request() method to specify the properties of the request you are trying to make.
Watcher API plugin for the elasticsearch.js client.
elasticsearch-watcher is available on NPM:
npm install elasticsearch elasticsearch-watcher
bower:
bower install elasticsearch elasticsearch-watcher
Or by simply downloading elasticsearch-watcher.js and including it in your project.
NOTE: The elasticsearch-watcher.js file uses a UMD wrapper to greater compatibility and exports a global ElasticsearchWatcher variable when neither AMD or Common.js module systems are detected.
The elasticsearch-watcher API is a plugin for the elasticsearch.js client. To mix it into an instance of Client we pass the entire module like so:
var elasticsearch = require('elasticsearch');
var elasticsearchWatcher = require('elasticsearch-watcher');
var client = new elasticsearch.Client({
plugins: [ elasticsearchWatcher ]
});
Doing this will add the client.watcher api to the client instance:
client.watcher.getWatch({ id: 42 })
.then(function (resp) {
...
});
Documentation for the watcher api is available at elastic/elasticsearch-watcher-js/docs/api.asciidoc for the time being.
Copyright 2015 Elasticsearch
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.