Published by Erin Dustin
January 24th, 2023
We're excited to unveil an enhancement for OrderCloud's premium search feature: a self-service tool for viewing and rebuilding your search indexes. By the end of this article, you should be ready to investigate and resolve basic search indexing errors in your marketplace, eliminating the need to seek additional support from Sitecore in most cases.
The following section builds upon previous content on OrderCloud's premium search capabilities. Understanding these concepts will be helpful when troubleshooting your marketplace's search indexes.
Registered portal users now have visibility to search index details for their assigned marketplaces. After selecting a marketplace from the list, you will have the option to view either Product or Order search indexes from the tab selections.
The detail view for a selected search index will display the following:
Not seeing a search index for your resource type? You will need to create items for that resource first (reminder that only submitted Orders are indexed) and make a call to list either products or orders depending on the index type. Also keep in mind that premium search for Orders may not be enabled for your Production marketplace if it was created prior to April 20, 2022.
As previously mentioned, xp schema errors arise when Elasticsearch encounters inconsistent types on xp values within the same resource. Let's walk through a simple example of one such inconsistency and how to interpret the error. Let’s say two products are created, both with the same xp key name, but with different value types (e.g. an integer and a boolean). This inconsistency produces the following error: "Failed to parse field [xp.FreeShipping] of type [boolean] in document with id 'product2'. Preview of field's value: '0'"
Elasticsearch dynamically maps xp datatypes at index time and will reject incoming documents when it cannot coerce the xp value to the previously determined types. In this example
product1 was created and indexed first. As a result, Elasticsearch was not able to coerce the value of
int) to a
boolean, and it was excluded from the index due to an inconsistent xp value type.
If you encounter an index error in your marketplace, you will notice that search results may not behave as expected. In this example,
GET v1/products/product2 would return the product as expected, but that same product would not appear in a
GET v1/products list.
To correct search index errors you will need to ensure that xp types are consistent across all items for the given search index type. Consider the following two scenarios. First, let’s say that you intended for this key-value pair to be of type
boolean for your Product schema. In this instance, Elasticsearch has already inferred the correct type, and you would merely need to PATCH
false to correct the error. However, let’s say that you intened to update your Product schema so that the key-value pair is of type
int. You would first need to PATCH
0, then additionally trigger a manual rebuild of your index. This last step is required because you will need to "reset" your index to recognize the updated Product xp types.
Resetting your index with a manual rebuild is a necessary step if you intend to update your xp schema. After ensuring that all items in your resource have consistent xp types, navigate to your active index and locate the Rebuild button. Triggering a rebuild will generate a brand-new index from the master OrderCloud record. A few things to note for the rebuild action:
If issues persist, please reach out to OrderCloud support for assistance.