-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathElasticsearch.js
29 lines (27 loc) · 912 Bytes
/
Elasticsearch.js
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
29
const { Client } = require('@elastic/elasticsearch')
/**
* @name Elasticsearch
*
* @synopsis
* ```coffeescript [specscript]
* Elasticsearch(node string) -> Elasticsearch
* ```
*
* @description
* https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html
*
* https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/7.x/introduction.html
* https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/7.x/api-reference.html
* https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html
* https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html
*
* ```javascript
* Elasticsearch('http://localhost:9200')
* ```
*/
const Elasticsearch = function (node) {
const elasticsearch = new Client({ node })
elasticsearch.ready = elasticsearch.cat.health()
return elasticsearch
}
module.exports = Elasticsearch