Open navigation

Metafields as Facets/Searchable attribute

What is a Metafield?

In Shopify, the metafields object allows you to store additional information for products, collections, pages etc. There are several apps in the Shopify App Store that one can use to manage metafields.

As far as the metafields in Klevu Search are concerned, they can be used as the additional attributes holding additional information about the products that you may want Klevu Search to index and search to bring the relevant products back in the search results. It is also possible to use them as facets and allow your shoppers to filter the results.

The guide below explains how to use metafields in Klevu Search.

Mapping Metafields for Indexing

  1. Log into MyShopify Admin Panel
  2. Go to Apps → Klevu Search → Settings
  3. Click on the Manage Metafields button

Ratings Data

Klevu indexes product rating and rating count data separately to other metafields and, as such, the app provides specific rows for you to map the metafields which contain this data. These rows can be found at the top of the metafields table. While they cannot be removed, you should leave these empty if you are not sending rating information.

Because they are not synced in the same way as other metafields, you do not need to enter a title and they will always be indexed as facets.

You should ensure that any metafields mapped always return numeric data.

Note: you cannot map the same metafield for both Rating and Rating Count.

If you are using the Shopify Product Reviews plugin, the namespace and key values you should use are 
  • Rating: reviews.rating 
  • Rating Count: reviews.rating_count 
For any other implementation, please refer to the plugin’s documentation or check under Settings → Metafields → Products in your MyShopify admin area.
Before November 2022, the application would map any definition with the title “Rating” as the product rating automatically and index accordingly. This is no longer the case and using “Rating” as the title of a metafield no longer has special behaviour associated.

Other Metafields

Below the Rating fields, you can map as many or as few metafields as you need. To add a new definition, click the Add Metafield link and to remove one click the delete icon at the end of the relevant row.

If you accidentally delete a definition you wish to keep, reloading the page before submitting will restore your settings.

Each row requires a unique Title, as well as the metafield namespace and key (as found under Settings → Metafields → Products in your MyShopify admin area)

If you want to show the Metafield as a facet in search, please tick the Facet checkbox

Reserved Keys

There are some keys which cannot be sent in the additional metafields section of your feed as they conflict with other attributes in the index, for example rating and rating_count (For an up-to-date list of all reserved keywords, please refer to the Sync Field Name tooltip within the app).

If you wish to map a metafield which uses one of these keys, you will need to provide an alternative key in the Sync Field Name input (with the same reserved key constraints applicable).

Where a Sync Field Name value is present, this is the key which will be used to send data to Klevu, while the metafield mapped using Namespace and Key will continue to be used for the source data.

Existing metafields (entered before November 2022) which use a reserved key will no longer be sent to Klevu as part of the data sync and will not be remapped automatically. You will need to take manual action and provide a Sync Field Name in these situations.

Duplicate Keys

If you wish to map different metafields which use the same Key value in a different Namespace, you will need to provide an alternative key for one or more conflicting rows in the Sync Field Name input. As with reserved keys, this will only affect the data sent to Klevu, and not the actual metafield used for the source data.

Existing metafields (entered before November 2022) with duplicate keys will not be remapped automatically. You will need to take manual action and provide a Sync Field Name in these situations.

Variant Metafields

By default, variant metafields are ignored when indexing data unless explicitly enabled through App Settings → Do You Want to Use Variant Product Metafield in Index?

When variant metafields are enabled, you should use the variant’s namespace and key values when mapping in the same way as for product metafields.

Where a metafield exists with the same namespace and key for both Products and Variants, and that metafield is mapped to send to Klevu, the data from both the product and the variant will be sent if present

Sending Metafields to Klevu

To synchronize these metafields with Klevu Search, please go to Klevu Merchant Center → Catalog Sync → On-demand Sync and click on the Sync Now button.

Klevu will index the metafields and they will start appearing as facets (if UseAsFacet is selected) in the search results

Does the indexing of metafields slow down indexing?

Beta functionality notice: We are currently trialing a new approach using GraphQL for synching metafields, which may improve sync times for some stores. Please click here for more information.

Unfortunately yes, it will slow down the collection of data for indexing.  We use Shopify's API calls to collect the product data. Whilst, with a single API call, we are able to fetch data for more than one product ( allowing us to gather the data at full speed), unfortunately, it isn't yet possible to do the same for metafields. We have to fire one call per product to obtain the metafields information. Given the restrictions on the number of API calls we can fire per second with Shopify when the metafields are configured to be used with Klevu Search, the entire process of collecting data slows down (i.e. up to 600 calls every 5 minutes and 1200 calls every 5 minutes for the Shopify plus account).

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.