这个 Azure 搜索索引错误是什么意思? "The property 'x' does not exist on type 'search.documentFields'..."
What does this Azure Search indexing error mean? "The property 'x' does not exist on type 'search.documentFields'..."
我得到的异常是:The property 'documentType' does not exist on type 'search.documentFields'. Make sure to only use property names that are defined by the type.
我用谷歌搜索了这个,但仍然无法弄清楚发生了什么。
这是我们使用的模型:
[SerializePropertyNamesAsCamelCase]
public class WebSearchDocument : SearchDocument, IEventSearchDocument, IResourceSearchDocument
{
[IsFacetable]
public string DocumentType { get; set; }
[IsSearchable]
public string Title { get; set; }
[IsSearchable]
public string Description { get; set; }
[IsFilterable]
public DateTime? PublishedDate { get; set; }
public DateTime? LastUpdatedDate { get; set; }
public string ImageUrl { get; set; }
public string LinkToResource { get; set; }
public string EventCode { get; set; }
[IsSearchable, IsFilterable]
public string Location { get; set; }
[IsFilterable]
public DateTime? EventStartDate { get; set; }
[IsFilterable]
public DateTime? EventEndDate { get; set; }
}
最后,这是 Azure 上的索引字段
根据@Bruce Johnson 的要求,这里有更多信息
服务名称:bacp-search
有问题的索引 bacp-web-dev
我们正在使用 Microsoft.Azure.Search 3.0.3 (NuGet)
搜索文档库:
[SerializePropertyNamesAsCamelCase]
public abstract class SearchDocument : ISearchDocument
{
/// <summary>
/// Gets or sets the ID for the document. For consistency, this should never be updated or retrieved manually.
/// All IDs should be set through the <see cref="Id"/> property.
/// </summary>
[Key]
[JsonProperty("Id")]
public string AzureId { get; set; }
/// <summary>
/// Gets or sets any unique IDs or compound IDs that might contain characters unsafe for transmission via URL.
/// For consistency, all IDs should be set through this property.
/// </summary>
[JsonIgnore]
[IsRetrievable(false)]
public string Id
{
get
{
return AzureId.FromBase64EncodedString();
}
set
{
AzureId = value.ToBase64EncodedString();
}
}
}
一般来说,此错误表示索引有效负载中的 属性 不存在于索引定义中。在这个特定的实例中,这是因为索引请求被发送到错误的索引,而目标索引实际上没有 documentType
字段。
我得到的异常是:The property 'documentType' does not exist on type 'search.documentFields'. Make sure to only use property names that are defined by the type.
我用谷歌搜索了这个,但仍然无法弄清楚发生了什么。
这是我们使用的模型:
[SerializePropertyNamesAsCamelCase]
public class WebSearchDocument : SearchDocument, IEventSearchDocument, IResourceSearchDocument
{
[IsFacetable]
public string DocumentType { get; set; }
[IsSearchable]
public string Title { get; set; }
[IsSearchable]
public string Description { get; set; }
[IsFilterable]
public DateTime? PublishedDate { get; set; }
public DateTime? LastUpdatedDate { get; set; }
public string ImageUrl { get; set; }
public string LinkToResource { get; set; }
public string EventCode { get; set; }
[IsSearchable, IsFilterable]
public string Location { get; set; }
[IsFilterable]
public DateTime? EventStartDate { get; set; }
[IsFilterable]
public DateTime? EventEndDate { get; set; }
}
最后,这是 Azure 上的索引字段
根据@Bruce Johnson 的要求,这里有更多信息
服务名称:bacp-search
有问题的索引 bacp-web-dev
我们正在使用 Microsoft.Azure.Search 3.0.3 (NuGet)
搜索文档库:
[SerializePropertyNamesAsCamelCase]
public abstract class SearchDocument : ISearchDocument
{
/// <summary>
/// Gets or sets the ID for the document. For consistency, this should never be updated or retrieved manually.
/// All IDs should be set through the <see cref="Id"/> property.
/// </summary>
[Key]
[JsonProperty("Id")]
public string AzureId { get; set; }
/// <summary>
/// Gets or sets any unique IDs or compound IDs that might contain characters unsafe for transmission via URL.
/// For consistency, all IDs should be set through this property.
/// </summary>
[JsonIgnore]
[IsRetrievable(false)]
public string Id
{
get
{
return AzureId.FromBase64EncodedString();
}
set
{
AzureId = value.ToBase64EncodedString();
}
}
}
一般来说,此错误表示索引有效负载中的 属性 不存在于索引定义中。在这个特定的实例中,这是因为索引请求被发送到错误的索引,而目标索引实际上没有 documentType
字段。