【问题标题】:Retrieving GET /stats of Elastic search using NodeJS client使用 NodeJS 客户端检索 Elastic 搜索的 GET /stats
【发布时间】:2021-05-03 11:49:28
【问题描述】:

我可以使用 kibana 在本地环境中轻松获取此 elasticsearch 命令 (GET /_stats) 响应。但是,我需要在 node.js 服务器上运行该命令。 我尝试了以下方法,但它不起作用,而是引发错误。谁能帮我解决这个问题?

const client = new Client({
 node: process.env.ES_URL,
 auth: {
 username: process.env.ES_USER,
 password: process.env.ES_PASSWORD,
  },
});
const stats = await client.stats();
...
//The error response is TypeError: client.stats is not a function

PS:在 Kibana 上使用此命令返回相同的结果 (GET _cluster/health)

const {body} = await client.cluster.health({});

【问题讨论】:

    标签: node.js elasticsearch elastic-stack


    【解决方案1】:

    您尝试过client.cluster.stats() 吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-08
      • 2011-05-28
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多