本文介绍了将Angle 5与ElasticSearch连接时获取流程未定义错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次使用带有弹性的角度,并且在 this.client = new Client(// ..行上遇到了以上错误。

It's my first time using angular with elastic and I am getting the above error on the line "this.client = new Client(//.."

exact错误

这是相关代码

import { Client } from 'elasticsearch';
import { Injectable } from '@angular/core';

@Injectable()
export class ElasticsearchService {

  private client: Client;

  queryalldocs = {
    'query': {
      'match_all': {}
    }
  };

  constructor() {
    if (!this.client) {
      this.connect();
    }
  }

  private connect() {
    this.client = new Client({
      host: 'http://localhost:9200',
      log: 'trace'
    });
  }


推荐答案

重新安装模块即可解决此问题。首先不知道是什么原因导致安装失败。

Reinstalling the module solved the issue. Don't know what broke the installation in the first place.

这篇关于将Angle 5与ElasticSearch连接时获取流程未定义错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 21:50