【发布时间】:2018-04-24 08:02:04
【问题描述】:
我在尝试通过代码优先方法更新 Azure 搜索文档架构时遇到错误。
我们当前的实体具有架构:
public class SearchDocument
{
[DataAnnotations.Key]
public string ID;
[IsSearchable]
public string Title;
[IsSearchable]
public string Content;
}
但我想添加一个字段,使其变为:
public class SearchDocument
{
[DataAnnotations.Key]
public string ID;
[IsSearchable]
public string Title;
[IsSearchable]
public string Content;
[IsSortable]
public bool Prioritize;
}
在运行重新索引查询时,我收到错误:
"The request is invalid. Details: parameters : The property 'Prioritize' does not exist on type 'search.documentFields'. Make sure to only use property names that are defined by the type."
这很有意义...但是有没有办法预先检查架构是否匹配,并更新 Azure 架构?我知道其他云数据库,例如 Parse (dead) 和 Backendless (自从我上次使用它以来可能已经改变),具有基于 POST 的实体架构的自动实体更新,那么在 Azure 中有什么方法可以做到这一点?
我有 found a couple 文章 on MSDN 关于更新索引器,但无法测试(由于封闭的开发环境......我知道,对不起)。
我特别担心的一件事是第一个链接中的警告:
Important
Currently, there is limited support for index schema updates. Any schema
updates that would require re-indexing such as changing field types are not
currently supported.
那么这甚至可能吗?还是我必须在本地更新架构,然后登录 Azure 门户并手动更新索引器架构?非常感谢任何帮助!
【问题讨论】: