0

我在我的应用程序中使用elasticsearch js,并已成功连接和查询来自 elastic 的数据。

我现在正在尝试实现该count()方法以返回索引中的文档数。这是简单的代码片段:

elasticClient.count(/* params: CountParams */)

我替换params: CountParams为,indexName但我现在收到一个非法参数异常,说... [/_count] contains unrecognized parameters ...

我在任何地方都找不到关于计数方法的任何文档,无论是在 api、堆栈溢出还是在其他站点上。

如果有人能提供一个工作示例或任何链接,我将不胜感激。

谢谢!

4

1 回答 1

0

Does this help? Seems like that would be what you need, though it does not contain an actual example.

edit: how exactly does your call look? I'm not using the js client currently, but I assume you would have to add the parameter? Something like this maybe?

elasticClient.count({index: 'index-name'})
于 2019-07-09T14:15:14.910 回答