1 | "use strict";
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | var __metadata = (this && this.__metadata) || function (k, v) {
|
9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10 | };
|
11 | var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12 | return function (target, key) { decorator(target, key, paramIndex); }
|
13 | };
|
14 | Object.defineProperty(exports, "__esModule", { value: true });
|
15 | const common_1 = require("@nestjs/common");
|
16 | const elasticsearch_1 = require("elasticsearch");
|
17 | const rxjs_1 = require("rxjs");
|
18 | const elasticsearch_client_provider_1 = require("./elasticsearch-client.provider");
|
19 | let ElasticsearchService = class ElasticsearchService {
|
20 | constructor(esClient) {
|
21 | this.esClient = esClient;
|
22 | }
|
23 | getClient() {
|
24 | return this.esClient;
|
25 | }
|
26 | getSource(params) {
|
27 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.getSource))(params);
|
28 | }
|
29 | clearScroll(params) {
|
30 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.clearScroll))(params);
|
31 | }
|
32 | ping(params) {
|
33 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.ping))(params);
|
34 | }
|
35 | search(params) {
|
36 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.search))(params);
|
37 | }
|
38 | scroll(params) {
|
39 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.scroll))(params);
|
40 | }
|
41 | count(params) {
|
42 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.count))(params);
|
43 | }
|
44 | create(params) {
|
45 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.create))(params);
|
46 | }
|
47 | update(params) {
|
48 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.update))(params);
|
49 | }
|
50 | updateByQuery(params) {
|
51 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.updateByQuery))(params);
|
52 | }
|
53 | delete(params) {
|
54 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.delete))(params);
|
55 | }
|
56 | deleteByQuery(params) {
|
57 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.deleteByQuery))(params);
|
58 | }
|
59 | deleteScript(params) {
|
60 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.deleteScript))(params);
|
61 | }
|
62 | exists(params) {
|
63 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.exists))(params);
|
64 | }
|
65 | bulk(params) {
|
66 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.bulk))(params);
|
67 | }
|
68 | fieldStats(params) {
|
69 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.fieldStats))(params);
|
70 | }
|
71 | get(params) {
|
72 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.get))(params);
|
73 | }
|
74 | index(params) {
|
75 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.index))(params);
|
76 | }
|
77 | info(params) {
|
78 | return rxjs_1.bindNodeCallback(this.bindClientContext(this.esClient.info))(params);
|
79 | }
|
80 | close() {
|
81 | return this.esClient.close();
|
82 | }
|
83 | bindClientContext(fn) {
|
84 | return fn.bind(this.esClient);
|
85 | }
|
86 | };
|
87 | ElasticsearchService = __decorate([
|
88 | common_1.Injectable(),
|
89 | __param(0, common_1.Inject(elasticsearch_client_provider_1.ELASTICSEARCH_CLIENT)),
|
90 | __metadata("design:paramtypes", [elasticsearch_1.Client])
|
91 | ], ElasticsearchService);
|
92 | exports.ElasticsearchService = ElasticsearchService;
|