---
title: Specify which fields to index
slug: '2499'
canonical_url: https://docs.coveo.com/en/2499/
collection: coveo-for-sitecore-v5
source_format: adoc
---
# Specify which fields to index

This article applies to indexing with the [native connector](https://docs.coveo.com/en/pa780168.md) included in the [Coveo for Sitecore package](https://docs.coveo.com/en/2123.md#coveo-for-sitecore-package).

The Sitecore Search Provider framework offers various parameters to alter item indexing.

One of them is fields inclusion and exclusion.
This only affects the internal `SitecoreItemCrawler` module and not the Coveo Search Provider directly, so it can be used on any Sitecore Search Provider index.

## Including or excluding fields from the indexing

Coveo for Sitecore only indexes a small number of fields, the ones it needs to function properly.
For more information on the entire field selection process, see [About the coveoIndexingGetFields pipeline](https://docs.coveo.com/en/2557.md).

There are several ways to include additional fields to the indexing process.

### Using the Command Center (recommended)

The Coveo **Command Center** is the easiest way to browse through all the Sitecore fields and to choose which ones to index (see [About the Indexing Manager - Fields](https://docs.coveo.com/en/2566.md#fields)).

### Updating the configuration files directly

> **Leading practice**
>
> Using the [Command Center](#using-the-command-center-recommended) is now recommended over updating configuration files directly.
In the `<SITECORE_INSTANCE_ROOT>\App_Config\Include\Coveo\Coveo.SearchProvider.Custom.config` patch file, use `<include hint="list:AddIncludedField">` or `<exclude hint="list:AddExcludedField">` elements as immediate children of the `configuration/sitecore/coveo/defaultIndexConfiguration/documentOptions` element.
Then, specify the Sitecore fields to be included/excluded as child elements using their `Item ID`.

> **Important**
>
> When including or excluding many fields, remember to use different element names for each field.
> Otherwise, only the last child of the `<include>`/`<exclude>` element of a given name will actually be included/excluded.
> Descriptive field element names can serve this purpose and help you identify the content you're including or excluding from the index.
**Example**

```xml
<include hint="list:AddIncludedField">
  <field5>{BEAE618D-3D5B-483A-A9B3-2A5938DEB9A3}</field5>
  <field6>{906B3C98-629B-41D6-890D-EF13B3C1E47D}</field6>
</include>
```
**Example**

```xml
<exclude hint="list:AddExcludedField">
  <field7>{930B0A7B-BACA-4D1E-B108-205CFDA1E778}</field7>
  <field8>{5D1786F8-5165-413A-A299-A39ECDD4B0D3}</field8>
</exclude>
```
### Using both configuration files and the Command Center

You can include fields using both configuration files and the **Command Center**.
However, you might be surprised by certain system behaviors if you don't properly understand:

* what happens when you add or remove fields using the **Command Center**
* how Coveo for Sitecore ultimately determines the list of fields to index

The following diagram shows an example of a field inclusion patch file configuration.
Including or excluding a field through the **Command Center** simply adds/removes a field element in the `<include>` element of the last Coveo for Sitecore configuration patch file in the file patching order (`Coveo.SearchProvider.Fields.Custom.config`).
Field elements added within the `<include>` element of `Coveo.SearchProvider.Fields.Custom.config` follow a naming convention that make them unique, such that they're always added to the field elements you might have added in `Coveo.SearchProvider.Custom.config`.

![Diagram showing the order of file patching for including fields in Coveo](https://docs.coveo.com/en/assets/images/c4sc-v5/include-fields-file-patch-order.svg)

At runtime, the `IncludeFieldsFromConfigOnlyProcessor` processor retrieves the field elements in the `<include hint="list:AddIncludedField" >` element of the compiled configuration (see [Default processing sequence diagram](https://docs.coveo.com/en/2557.md#default-processing-sequence-diagram)).
These are the fields Coveo for Sitecore ultimately indexes.

Hence, with the sample configuration above, if you try using the **Command Center** to remove one of the two fields that you included through the `Coveo.SearchProvider.Custom.config` file, you won't notice, after the **Save & Restart**, that Coveo for Sitecore has _not_ removed the field.
The only way for you to exclude those two fields now is to remove them from the `Coveo.SearchProvider.Custom.config` file.

### Using a Coveo for Sitecore pipeline

You can include and exclude fields using the `coveoPostItemProcessingPipeline` (see [About the coveoPostItemProcessingPipeline pipeline](https://docs.coveo.com/en/2559.md)).

### Using the Coveo for Sitecore indexing API

The Coveo for Sitecore Indexing API offers several methods to update the fields list (see [Coveo for Sitecore Indexes Service API](https://docs.coveo.com/en/2129.md#coveo-for-sitecore-indexes-service-api)).