---
title: "Work with search"
slug: "work-with-search"
abstract: "Information on working with search including indexing, synchronous and asynchronous search and other relevant details."
---
# Work with search

The xConnect Client API allows you to search [contacts](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/search-contacts.html "Search contacts") (via `client.Contacts`) and [interactions](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/search-interactions.html "Search interactions") (via `client.Interactions`). Interaction search is also known as behavioral search. It is not possible to query events and facets directly - you must structure your query around contacts or interactions as demonstrated in the following table:

| Query Requirement | Query |
| --- | --- |
| Get all London addresses | Get all contacts where the `AddressList` facet contains a London address |
| Get all page visits that occurred yesterday | Get all interactions that occurred yesterday and contain events of type `PageViewEvent` |
| Get all ‘download’ events from the last week | Get all interactions that occurred in the last week and contain `DownloadEvent` events |

<details>
<summary><h2>Indexing</h2></summary>

> [!important]
> Indexing is performed by a dedicated search indexer, not by the processing server. This is a significant change from version 8.2 and earlier versions.

For more information about indexing and the architecture of xConnect search, see:

- [Search and indexing flows](https://doc.sitecore.com/xp/en/developers/100/platform-administration-and-architecture/indexing-and-segmentation.html)
- [xConnect indexing](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/the-xdb-search-index.html "The xDB search index")

</details>

<details>
<summary><h2>Synchronous and asynchronous search</h2></summary>

Refer to the [xConnect Client API overview](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/xconnect-client-api-overview.html "xConnect Client API overview") for a complete list of synchronous and asynchronous extension methods.

</details>

<details>
<summary><h2>xConnect does not use Sitecore.ContentSearch</h2></summary>

xConnect search **does not** rely on `Sitecore.ContentSearch`. xConnect search and Content Search are separate frameworks with separate APIs and indexing mechanisms. For more information, refer to the [search and indexing overview](https://doc.sitecore.com/xp/en/developers/100/platform-administration-and-architecture/search-and-indexing-overview.html).

</details>

<details>
<summary><h2>Search is case-insensitive</h2></summary>

Search is case-insensitive by default to make it easier to locate results. This is set at Solr schema level.

</details>

<details>
<summary><h2>Support for joins depends on the search provider</h2></summary>

Solr supports joins between contacts and interactions. Azure Search does not currently support joins.

The following example demonstrates how to search for any contact that has downloaded a particular media item. The query uses a join.

```

var mediaItemId = Guid.Parse("bf34c300-0c0a-4aab-9055-97854f17d134");

var query = client.Contacts.Where(c => c.Interactions.Any(x => x.Events.OfType<DownloadEvent>().Any(d => d.ItemId == mediaItemId)));

var results = await query.GetBatchEnumerator(10);

```

If you are using a search provider that does not support joins, you must use the contact’s `InteractionsCache` facet:

```

var mediaItemId = Guid.Parse("bf34c300-0c0a-4aab-9055-97854f17d134");

var query = client.Contacts.Where(c => c.InteractionsCache().InteractionCaches.Any(x => x.DownloadEventItemIds.Any(f => f == mediaItemId)));

var results = await query.GetBatchEnumerator(10);

```

</details>