To interact with Elasticsearch using NEST, we need to be able to contol how POCO types in our solution map to JSON documents and fields stored within the inverted index in Elasticsearch. This section describes all of the different functionality available within NEST that makes working with POCOs and Elasticsearch a breeze.

Explicitly mapping documents in Elasticsearch is crucial in providing bespoke search solutions for a given problem domain. Whilst Elasticsearch is able to infer the mapping for a given type in an index based upon the first document of that type that it encounters, the inferred mapping is sometimes not sufficient to building a great search experience.

To explicitly control mapping, an explicit type mapping can be specified when creating an index, or added to an existing index before indexing the first document of that type (because indexing a document without an explicit mapping will cause Elasticsearch to infer the mapping).

There are several ways to control mapping in NEST

and these can be combined to form an overall mapping approach. In addition, there are also ways to control