【发布时间】:2019-03-04 11:23:55
【问题描述】:
我正在为 Elasticsearch 6 使用 NEST,并希望获取默认索引的文档数。
documentation 指的是 API 的 1.1 版本,它似乎不再起作用。
我已经使用默认索引创建了连接设置:
var connectionSettings = new ConnectionSettings().DefaultIndex("test_docs");
当我尝试 1.1 api 文档中的代码时:
var result = client.Count();
我收到以下错误:
方法的类型参数 'ElasticClient.Count(Func, ICountRequest>)' 不能从用法推断。尝试指定类型参数 明确的。
当我提供一个类型时,它会附加到路径中。例如:
client.Count<TestDocument>();
当我真正需要的是http://localhost:9200/test_docs/_count时,生成一个http://localhost:9200/test_docs/testdocument/_count的URL
【问题讨论】:
标签: elasticsearch nest