在测试应用程序中,我想创建搜索索引。文档不出现在Azure文档中
我有我想要发送到天蓝色搜索索引的对象列表。
用下面的代码创建索引本身:
await client.Indexes.CreateAsync(myIndexDefinition);
这工作,我可以用定义字段看到指数在门户网站。
现在我试着添加一个文档。
using (SearchIndexClient index = client.Indexes.GetClient(cityIndexName))
{
List<IndexAction> items = cities.Select(CreatecCtion).ToList();
var batch = new IndexBatch(items);
await index.Documents.IndexAsync(batch);
}
[...]
private IndexAction CreateACtion(city city)
{
var doc = new Document
{
{ "CityId", city.Id }
};
var action = new IndexAction(IndexActionType.Upload, doc);
return action;
}
运行代码后,所有项目的结果说,他们是全成和conain我设置ID。但是,当我在这个指数的门户网站看,计数为0.
任何暗示我做错了什么?墨菲定律