Skip to content

Commit b126243

Browse files
committed
added test to illustrate #902
1 parent f2c6ec1 commit b126243

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@
368368
<Compile Include="QueryParsers\Visitor\DslPrettyPrintVisitor.cs" />
369369
<Compile Include="QueryParsers\Visitor\VisitorDemoUseCase.cs" />
370370
<Compile Include="QueryParsers\Visitor\VisitorTests.cs" />
371+
<Compile Include="Reproduce\Reproduce902Tests.cs" />
371372
<Compile Include="Reproduce\Reproduce646Tests.cs" />
372373
<Compile Include="Reproduce\Reproduce579Tests.cs" />
373374
<Compile Include="Reproduce\Reproduce860Tests.cs" />
@@ -769,6 +770,9 @@
769770
<None Include="Reproduce\Issue579.json">
770771
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
771772
</None>
773+
<None Include="Reproduce\Issue902.json">
774+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
775+
</None>
772776
<None Include="Reproduce\Issue876.json">
773777
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
774778
</None>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"query": {
3+
"match": {
4+
"name": {
5+
"query": ""
6+
}
7+
}
8+
}
9+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using NUnit.Framework;
6+
7+
namespace Nest.Tests.Unit.Reproduce
8+
{
9+
/// <summary>
10+
/// tests to reproduce reported errors
11+
/// </summary>
12+
[TestFixture]
13+
public class Reproduce902 : BaseJsonTests
14+
{
15+
[ElasticType(Name = "testclass")]
16+
public class TestClass
17+
{
18+
public int Id { get; set; }
19+
20+
public NestedClass NestMe { get; set; }
21+
}
22+
23+
public class NestedClass
24+
{
25+
public string NestedMultiField { get; set; }
26+
}
27+
28+
public class ChildRecord
29+
{
30+
31+
}
32+
33+
/// <summary>
34+
/// https://github.com/Mpdreamz/NEST/issues/902
35+
/// </summary>
36+
[Test]
37+
public void Issue902()
38+
{
39+
var mapResult = this._client.Map<TestClass>(m => m
40+
.MapFromAttributes()
41+
.Properties(props => props
42+
.NestedObject<NestedClass>(nested => nested
43+
.Name(p=>p.NestMe)
44+
.Properties(nestedProps=>nestedProps
45+
.MultiField(s => s
46+
.Name(p => p.NestedMultiField)
47+
.Fields(fields => fields
48+
.String(ps => ps.Name(p => p.NestedMultiField.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed))
49+
.String(ps => ps.Name(p => p.NestedMultiField).Index(FieldIndexOption.Analyzed))
50+
)
51+
)
52+
)
53+
)
54+
)
55+
);
56+
var json = mapResult.ConnectionStatus.Request;
57+
this.JsonEquals(json, MethodBase.GetCurrentMethod());
58+
}
59+
60+
}
61+
}

0 commit comments

Comments
 (0)