World is now on Opti ID! Learn more

dada
Jun 5, 2025
  0
(0 votes)

Avoid Field Type Conflicts in Search & Navigation

When using Optimizely Search & Navigation, reusing the same property name across different content types is fine — as long as the type is consistent. If one type uses int and another uses string, you'll run into indexing and query issues.

💥 The Issue

Optimizely Search & Navigation stores data in Elasticsearch, which assigns a data type to each field the first time it sees it. That type is then fixed.

If CategoryId is first indexed as an int, any later document sending "12" (as a string) under the same field name causes a conflict.

This can lead to:

  • Missing / fluctuating search results

  • Filters not working

  • Incorrect aggregations

  • Indexing errors

🧪 Example

public virtual List<int> CategoryId { get; set; }  // Used in one type
public virtual List<string> CategoryId { get; set; }  // Used in another

Query:

"term": { "CategoryId": 12 }

Only matches documents where CategoryId is an integer. 

✅ How to Prevent It

  • Keep the same type for shared field names across all content types - at least for those content types you will be indexing.

    It can be good to know that this is not always an issue because we do suffix many types (string gets the suffix $$string) meaning a plain string property and an integer propery will be keyed differently in the mappings. 

🧱 Root Cause

This is a limitation in Elasticsearch, not a bug in Optimizely Search & Navigation. Once a field is mapped with one type, it can’t accept another.

✅ Summary

  • Same name + different type = broken queries

  • Align types for all shared property names

  • Use consistent modeling to avoid mapping conflicts

Jun 05, 2025

Comments

Please login to comment.
Latest blogs
Make Global Assets Site- and Language-Aware at Indexing Time

I had a support case the other day with a question around search on global assets on a multisite. This is the result of that investigation. This co...

dada | Jun 26, 2025

The remote server returned an error: (400) Bad Request – when configuring Azure Storage for an older Optimizely CMS site

How to fix a strange issue that occurred when I moved editor-uploaded files for some old Optimizely CMS 11 solutions to Azure Storage.

Tomas Hensrud Gulla | Jun 26, 2025 |

Enable Opal AI for your Optimizely products

Learn how to enable Opal AI, and meet your infinite workforce.

Tomas Hensrud Gulla | Jun 25, 2025 |

Deploying to Optimizely Frontend Hosting: A Practical Guide

Optimizely Frontend Hosting is a cloud-based solution for deploying headless frontend applications - currently supporting only Next.js projects. It...

Szymon Uryga | Jun 25, 2025

World on Opti ID

We're excited to announce that world.optimizely.com is now integrated with Opti ID! What does this mean for you? New Users:  You can now log in wit...

Patrick Lam | Jun 22, 2025

Avoid Scandinavian Letters in File Names in Optimizely CMS

Discover how Scandinavian letters in file names can break media in Optimizely CMS—and learn a simple code fix to automatically sanitize uploads for...

Henning Sjørbotten | Jun 19, 2025 |