---
title: Exclude fields
slug: cms-12/docs/excluding-fields
docTags: 
createdAt: 2026-08-10T15:55:53.000Z
---

Optimizely Search & Navigation includes public properties on an object when indexing it by default. The simplest way to *exclude* a property is to annotate it with the `JsonIgnore` attribute in the `Newtonsoft.Json` namespace.

**Example**

```csharp
using Newtonsoft.Json;

public class User {
  public string Username {
    get;
    set;
  }

  [JsonIgnore]
  public string Password {
    get;
    set;
  }
}
```

You can also exclude properties or other previously included fields by customizing the `client` conventions.

```csharp
//using EPiServer.Find.ClientConventions;

client.Conventions
  .ForInstancesOf<User>()
  .ExcludeField(x => x.Password);
```

The above code excludes the `Password` property from instances of the `User` class and instances of classes that inherit the `User` class.
