Features Inferenceedit

Some URIs in Elasticsearch take a Feature enum. Within NEST, route values on the URI are represented as classes that implement an interface, IUrlParameter. Since enums cannot implement interfaces in C#, a route parameter that would be of type Feature is represented using the Features class that the Feature enum implicitly converts to.

Constructoredit

Using the Features constructor directly is possible but rather involved

Features fieldString = Feature.Mappings | Feature.Aliases;
Expect("_mappings,_aliases")
    .WhenSerializing(fieldString);

Implicit conversionedit

Here we instantiate a GET index request which takes two features, settings and warmers. Notice how we can use the Feature enum directly.

var request = new GetIndexRequest(All, Feature.Settings | Feature.Warmers);