Take the community feedback survey now.

dada
Jun 5, 2025
  524
(1 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
A day in the life of an Optimizely Developer - We Hacked the Future: Netcel's Opal Hackathon Adventure

Ever wondered what happens when you mix  AI ,  creativity , and a dash of competitive spirit? Welcome to the  Opal Hackathon 2025 —where we rolled ...

Graham Carr | Aug 31, 2025

Simple Feature Flags In Optimizely CMS

The Problem I was working with a CMS 11 client who wanted to introduce two new third party content sources. These would be synchronized into new...

Mark Stott | Aug 31, 2025

SQL addon for Optimizely CMS 12 updated with new features

First released in 2021, the SQL Studio addon for Optimizely CMS lets you query your database directly from the edit UI. The latest update adds...

Tomas Hensrud Gulla | Aug 29, 2025 |

🎓 New Certification Icons Are Now Live on World!

If you’ve passed an Optimizely Academy certification, you’ll now see something new beside your name on World —  fresh certification icons are live...

Satata Satez | Aug 29, 2025