There are two ways to search over multiple types:
**Implicit** – The `
IClient.Search<T>()` method supports inheritance by default. So, no extra effort is required to search over multiple types that share a common base class.
IncludeType` – Create a search request for one type, then include additional types in the request. When doing so, you must provide a projection from the additional type to the return type of the search request, either the original type or some projection.
You can create a search request for `
BlogPosts` and include the `
Article` type in the request, as shown in the following example.
In this case, you search for `
BlogPosts` and `
Articles` and retrieve the results as `
BlogPosts`. However, in most situations, it is preferable to project both types to a third type that is more suitable for search results, like this.
Although you can use the `
IncludeType` method to include additional types, the search request is built towards the first type. So, if you limit the request to search in specific fields and none of those exists in the other types, you only get hits from the first type. In practice, however, if you search through all content without limiting the request to specific fields, or if the types share the same name for fields, this is not a problem.