elasticsearch/elasticsearch-net — pull request #1145 by gmarz (2014-12-14 14:50:24+00:00)
Title: Add ability to configure id properties in code

Previously, the only way to specify an id property was to use the `ElasticTypeAttribute`:

`[ElasticType(IdProperty="AlternateId"]`

This PR introduces an alternative way to configure id properties, via code:

var settings = new ConnectionSettings()
.MapIdPropertyFor(o => o.AlternateId);

**Note:** Mapping two different id properties on the same type is an error:

var settings = new ConnectionSettings()
.MapIdPropertyFor(o => o.AlternateId)
.MapIdPropertyFor(o => o.AnotherId);

and will cause an `ArgumentException` to be thrown.

**Question:** How should we treat the case where a type has an Id property set via `ElasticTypeAttribute` and an id property is mapped in code? [Currently, the code mapping will take precedence](https://github.com/elasticsearch/elasticsearch-net/blob/feature/idproperty-in-code/src/Tests/Nest.Tests.Unit/Internals/Inferno/MapIdPropertyForTests.cs#L107), but I wonder if this should be an error instead?

Closes #407