.net - 如何检查认知搜索中是否存在索引?
问题描述
我想知道我的搜索实例中是否已经存在索引。
以前在图书馆的 v10 中,我可以这样做:
if (serviceClient.Indexes.Exists(indexName)) {...}
在 v11 中,SearchServiceClient
已被替换为SearchIndexClient
没有.Indexes
集合的 。
我尝试了下面的代码,但它爆炸了Fields cannot be null. To clear values, call Clear. (Parameter 'value')
:
string match = indexClient.GetIndexNames().SingleOrDefault(i => i == indexName);
那么查看索引是否存在的新方法是什么?
解决方案
你应该可以使用SearchIndexClient.GetIndexesAsync
它。
推荐阅读
- reactjs - 您可以在组件上使用样式组件关键帧内联吗?
- javascript - 使用 Devise 登录时遇到问题 - JSON.stringify 转义字符
- powershell - 模拟按下 windows 键的 powershell 代码是什么?
- sql - 作者相关书籍的计数错误为什么以及如何解决?
- wolfram-mathematica - 2组二维点间仿射变换矩阵的闭式解
- javascript - 如何处理来自 Node.js 中 API 的 HTTPs json 格式错误?
- c - 为什么我应该在 CTRL+D 之前按 ENTER 以指示标准输入的 EOF?
- apache-spark - Spark RDD 将 csv 文件中的所有字段加载为字符串
- java - 尝试添加新用户时出现 Spring Security 403 错误
- reactjs - 如何使用钩子在我的反应应用程序中编辑待办事项?