Skip to content

Instantly share code, notes, and snippets.

@tugberkugurlu
Last active July 14, 2016 11:16
Show Gist options
  • Save tugberkugurlu/2db30e31e09bcbab60beaaf7f0ff9c98 to your computer and use it in GitHub Desktop.
Save tugberkugurlu/2db30e31e09bcbab60beaaf7f0ff9c98 to your computer and use it in GitHub Desktop.

NEST version: 1.5.0

System.ArgumentException: An item with the same key has already been added.
  at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) <0x4151e330 + 0x00039> in <filename unknown>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Insert (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value, Boolean add) <0x41101000 + 0x0019b> in <filename unknown>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (System.Collections.Generic.TKey key, System.Collections.Generic.TValue value) <0x4114c880 + 0x00023> in <filename unknown>:0 
  at System.Collections.ObjectModel.KeyedCollection`2[TKey,TItem].AddKey (System.Collections.ObjectModel.TKey key, System.Collections.ObjectModel.TItem item) <0x414b62f0 + 0x00045> in <filename unknown>:0 
  at System.Collections.ObjectModel.KeyedCollection`2[TKey,TItem].InsertItem (Int32 index, System.Collections.ObjectModel.TItem item) <0x414b6240 + 0x0004b> in <filename unknown>:0 
  at System.Collections.ObjectModel.Collection`1[T].Add (System.Collections.ObjectModel.T item) <0x412408f0 + 0x000ad> in <filename unknown>:0 
  at Newtonsoft.Json.Utilities.CollectionUtils.AddRange[T] (IList`1 initial, IEnumerable`1 collection) <0x414b1280 + 0x000b3> in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) <0x414a9e90 + 0x000ec> in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) <0x414a4bd0 + 0x000ad> in <filename unknown>:0 
  at Nest.Resolvers.ElasticContractResolver.CreateContract (System.Type objectType) <0x415192d0 + 0x00038> in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) <0x414a4790 + 0x00149> in <filename unknown>:0 
  at Nest.Resolvers.SettingsContractResolver.ResolveContract (System.Type type) <0x415192a0 + 0x0002a> in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe (System.Object value) <0x414a4740 + 0x0003e> in <filename unknown>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) <0x414a4470 + 0x0009f> in <filename unknown>:0 
  at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) <0x414a3940 + 0x005b1> in <filename unknown>:0 
  at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) <0x41519270 + 0x00020> in <filename unknown>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) <0x41518fb0 + 0x00124> in <filename unknown>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) <0x41518ce0 + 0x00057> in <filename unknown>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) <0x41518ca0 + 0x0002a> in <filename unknown>:0 
  at Nest.NestSerializer.Serialize (System.Object data, SerializationFormatting formatting) <0x41518c30 + 0x0003b> in <filename unknown>:0 
  at Elasticsearch.Net.Connection.RequestHandlers.RequestHandlerBase.PostData (System.Object data) <0x415188b0 + 0x001e1> in <filename unknown>:0 
  at Elasticsearch.Net.Connection.RequestHandlers.RequestHandlerAsync.RequestAsync[T] (Elasticsearch.Net.Connection.RequestState.TransportRequestState`1 requestState, System.Object data) <0x41518590 + 0x000e4> in <filename unknown>:0 
  at Elasticsearch.Net.Connection.Transport.DoRequestAsync[T] (System.String method, System.String path, System.Object data, IRequestParameters requestParameters) <0x41516a50 + 0x000d0> in <filename unknown>:0 
  at Elasticsearch.Net.ElasticsearchClient.DoRequestAsync[T] (System.String method, System.String path, System.Object data, IRequestParameters requestParameters) <0x415169a0 + 0x0007c> in <filename unknown>:0 
  at Elasticsearch.Net.ElasticsearchClient.SearchAsync[T] (System.String index, System.String type, System.Object body, System.Func`2 requestParameters) <0x41515d10 + 0x0018a> in <filename unknown>:0 
  at Nest.RawDispatch.SearchDispatchAsync[T] (Nest.ElasticsearchPathInfo`1 pathInfo, System.Object body) <0x41514e90 + 0x006b4> in <filename unknown>:0 
  at Nest.ElasticClient.SearchAsync[T,TResult] (System.Func`2 searchSelector) <0x41510ce0 + 0x0014d> in <filename unknown>:0 
  at Nest.ElasticClient.SearchAsync[T] (System.Func`2 searchSelector) <0x41510c80 + 0x0003c> in <filename unknown>:0 
[ElasticType(Name = "item")]
public class Item
{
public string Id { get; set; }
[ElasticProperty(Index = FieldIndexOption.NotAnalyzed)]
public string PrimaryId { get; set; }
[ElasticProperty(Type = FieldType.Nested)]
public IEnumerable<Bar> Bars { get; set; }
public IEnumerable<Foo> Foos { get; set; }
}
public class Bar
{
public string AreaName { get; set; }
}
public class Foo
{
public string AreaName { get; set; }
}
@Mpdreamz
Copy link

AreaName is on two unrelated types though so not quite seeing why this would pop up just yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment