Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does this Azure Search indexing error mean? "The property 'x' does not exist on type 'search.documentFields'..."

The Exception I am getting is: The property 'documentType' does not exist on type 'search.documentFields'. Make sure to only use property names that are defined by the type.

I have googled this and still cannot figure out what is going on.

Here is the model we are using:

[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; }
}

And finally, this is the index fields on Azure enter image description here

Per @Bruce Johnson request, here is more information

Service Name: bacp-search
Index in question bacp-web-dev
We are using Microsoft.Azure.Search 3.0.3 (NuGet)

SearchDocument Base:

[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();
        }
    }
}
like image 835
Jason H Avatar asked May 26 '17 14:05

Jason H


People also ask

What is an azure search index?

In Azure Cognitive Search, a search index is your searchable content, available to the search engine for indexing, full text search, and filtered queries. An index is defined by a schema and saved to the search service, with data import following as a second step.

How do I create a search index in Azure?

Sign in to the Azure portal with your Azure account. Find your search service and on the Overview page, select Import data on the command bar to create and populate a search index. In the wizard, select Connect to your data > Samples > hotels-sample. This data source is built-in.

What is search service in Azure?

Azure Cognitive Search (formerly known as "Azure Search") is a cloud search service that gives developers infrastructure, APIs, and tools for building a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications.


1 Answers

In general, this error means that a property in the indexing payload is not present in the index definition. In this specific instance, it's because the indexing request is being sent to the wrong index, and the target index in fact does not have a documentType field.

like image 124
Bruce Johnston Avatar answered Oct 26 '22 22:10

Bruce Johnston