Skip to content

Commit e4def2d

Browse files
committed
Had to register the DictionaryKeysAreNotPropertyNamesJsonConverter globally so that Dictionaries on objects we index behave like we expect them too
1 parent b89e88c commit e4def2d

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/Nest.Tests.Unit/Core/Index/IndexTests.cs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,25 @@ public void IndexParameters()
3030
}
3131

3232
[Test]
33-
public void GetSupportsVersioning()
33+
public void IndexingDictionaryRespectsCasing()
3434
{
35-
//TODO: investigate version on get
36-
//The elasticsearch docs make no mention of being able to specify version
37-
//http://www.elasticsearch.org/guide/reference/api/get.html
35+
var x = new
36+
{
37+
FirstDictionary = new Dictionary<string, object>
38+
{
39+
{"ALLCAPS", 1 },
40+
{"PascalCase", "should work as well"},
41+
{"camelCase", DateTime.Now}
42+
}
43+
};
44+
var result = this._client.Index(x);
3845

39-
//this._client.Get<ElasticSearchProject>(g=>g.);
40-
}
41-
[Test]
42-
public void UpdateSupportsVersioning()
43-
{
44-
//TODO: investigate version on update
45-
//The elasticsearch docs make no mention of being able to specify version
46-
//http://www.elasticsearch.org/guide/reference/api/get.html
46+
var request = result.ConnectionStatus.Request;
47+
StringAssert.Contains("ALLCAPS", request);
48+
StringAssert.Contains("PascalCase", request);
49+
StringAssert.Contains("camelCase", request);
50+
StringAssert.Contains("firstDictionary", request);
4751

48-
//this._client.Get<ElasticSearchProject>(g=>g.);
4952
}
5053
}
5154
}

src/Nest/ElasticSerializer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public class ElasticSerializer
2020
private static readonly ConcurrentBag<JsonConverter> _defaultConverters = new ConcurrentBag<JsonConverter>
2121
{
2222
new IsoDateTimeConverter(),
23-
new FacetConverter()
23+
new FacetConverter(),
24+
new DictionaryKeysAreNotPropertyNamesJsonConverter()
2425
};
2526

2627
public ElasticSerializer(IConnectionSettings settings)

0 commit comments

Comments
 (0)