forked from sitepoint-editors/node-elasticsearch-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindices.js
More file actions
28 lines (23 loc) · 620 Bytes
/
indices.js
File metadata and controls
28 lines (23 loc) · 620 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(function () {
'use strict';
const elasticsearch = require('elasticsearch');
const esClient = new elasticsearch.Client({
host: '127.0.0.1:9200',
log: 'error'
});
const indices = function indices() {
return esClient.cat.indices({v: true})
.then(console.log)
.catch(err => console.error(`Error connecting to the es client: ${err}`));
};
// only for testing purposes
// all calls should be initiated through the module
const test = function test() {
console.log(`elasticsearch indices information:`);
indices();
};
test();
module.exports = {
indices
};
} ());