MapperParsingException during indexing when ContentAPI Search is installed

  • Updated

The following exception can occur during indexing when Content API Search is installed.

      An exception occurred while indexing (Content): MapperParsingException[failed
      to parse [ContentApiModel.leftContent.expandedValue.content.value]];
      nested: ElasticsearchIllegalArgumentException[unknown property [displayOption]];
  1. For this example look for model properties with the name Content that use different types. For instance these two properties would cause that error during indexing (even though they are in different classes). 
    virtual public ContentArea Content {get; set}
     virtual public XhtmlString Content {get; set}

    This query can be helpful for identifying identical property names with different types. Note that the property in question may not be Content so look at the error and adjust the query accordingly. 
    SELECT tblcontenttype.[Name] AS ContentTypeName
    ,tblPropertyDefinition.[name] AS PropertyName
    ,tblpropertydefinitiontype.[name] AS PropertyType
    FROM tblcontenttype
    JOIN tblPropertyDefinition ON tblPropertyDefinition.fkContentTypeID = tblcontenttype.pkid
    JOIN tblpropertydefinitiontype ON tblPropertyDefinition.fkPropertyDefinitionTypeID = tblpropertydefinitiontype.pkid
    WHERE tblpropertydefinition.[Name] = 'Content'
  2. If it does not need to be indexed add the [JsonIgnore] attribute to one or more of the properties.

  3. If it needs to be indexed rename the property to something else and migrate the existing data to the new property.

Similarly, if you see the below error you would need to rename the property called "name" but it may not be obvious about which class. The property "name" could be the property name of the block that lives in CustomPageProperty (the type referenced in the error).

    MapperParsingException[failed to parse []];
    nested: ElasticsearchIllegalArgumentException[unknown property [propertyDataType]];

Another less common cause would be modifications to the Content API models. If there is custom Content Delivery model logic, remove this temporarily, clear the index (demo index mappings can be cleared from, re-index, and check the logs.  

Note: EPiServer.ContentDeliveryApi.Search 3.6.0 (for CMS 12) has additional logging to catch when a property name matches a Content Delivery API property. 

  • CMS Core log warning if there are duplicate field name of 2 content types in a ContentArea even if Find throws an exception or not
  • The log content has the below format: [WRN] Duplicate property name 'content1' with different types in content 'MyBlock1'(ID: 116) and 'MyBlock2'(ID: 117). The property 'mainContentArea' of content 'Alloy Plan'(ID: 6) may not be indexed.