Skip to content

Commit 6ba96e9

Browse files
committed
Add test in attempt to reproduce #1278
1 parent e60e7c3 commit 6ba96e9

File tree

3 files changed

+210
-40
lines changed

3 files changed

+210
-40
lines changed

src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
<Compile Include="Reproduce\Reproduce1176Tests.cs" />
173173
<Compile Include="Reproduce\Reproduce1193Tests.cs" />
174174
<Compile Include="Reproduce\Reproduce1236Tests.cs" />
175+
<Compile Include="Reproduce\Reproduce1278Tests.cs" />
175176
<Compile Include="Reproduce\Reproduce769Tests.cs" />
176177
<Compile Include="Reproduce\Reproduce945Tests.cs" />
177178
<Compile Include="Reproduce\Reproduce953Tests.cs" />

src/Tests/Nest.Tests.Integration/Reproduce/Reproduce1234Tests.cs

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using FluentAssertions;
7+
using NUnit.Framework;
8+
9+
namespace Nest.Tests.Integration.Reproduce
10+
{
11+
[TestFixture]
12+
public class Reproduce1278Tests
13+
{
14+
[Test]
15+
public void UnmappedPropertiesAreNotIgnored()
16+
{
17+
var client = new ElasticClient();
18+
var index = "issue1278";
19+
if (client.IndexExists(index).Exists)
20+
client.DeleteIndex(index);
21+
var result = client.CreateIndex(index, c => c
22+
.Settings(s => s
23+
.Add("analysis.analyzer.folding.tokenizer", "standard")
24+
.Add("analysis.analyzer.folding.filter.0", "lowercase")
25+
.Add("analysis.analyzer.folding.filter.1", "asciifolding")
26+
)
27+
.AddMapping<ElasticVideo>(m => m
28+
.Type("video")
29+
.Properties(props => props
30+
.String(s => s
31+
.Name("CountryOfOrigin")
32+
.Index(FieldIndexOption.NotAnalyzed)
33+
)
34+
.String(s => s
35+
.Name("LanguageOfOrigin")
36+
.Index(FieldIndexOption.NotAnalyzed)
37+
)
38+
.MultiField(s => s
39+
.Name("Title")
40+
.Fields(fs => fs
41+
.String(x => x.Name("Title").Analyzer("english"))
42+
.String(y => y.Name(t => t.Title.Suffix("folded")).Analyzer("folding"))
43+
.String(y => y.Name(t => t.Title.Suffix("raw")).Index(FieldIndexOption.NotAnalyzed)))
44+
)
45+
.MultiField(s => s
46+
.Name("TitleEnglish")
47+
.Fields(fs => fs
48+
.String(x => x.Name("TitleEnglish").Analyzer("english"))
49+
.String(y => y.Name(t => t.TitleEnglish.Suffix("folded")).Analyzer("folding")))
50+
51+
)
52+
.MultiField(s => s
53+
.Name("Description")
54+
.Fields(fs => fs
55+
.String(x => x.Name("Description").Analyzer("english"))
56+
.String(y => y.Name(t => t.Description.Suffix("folded")).Analyzer("folding")))
57+
58+
)
59+
60+
.MultiField(s => s
61+
.Name("DescriptionEnglish")
62+
.Fields(fs => fs
63+
.String(x => x.Name("DescriptionEnglish").Analyzer("english"))
64+
.String(y => y.Name(t => t.DescriptionEnglish.Suffix("folded")).Analyzer("folding")))
65+
66+
)
67+
.String(s => s
68+
.Name("VideoImage")
69+
.Index(FieldIndexOption.No)
70+
)
71+
.String(s => s
72+
.Name("ClientId")
73+
.Index(FieldIndexOption.NotAnalyzed)
74+
)
75+
.Number(s => s
76+
.Name("ViewCount")
77+
.Index(NonStringIndexOption.NotAnalyzed)
78+
)
79+
.Number(s => s
80+
.Name("LikesCount")
81+
.Index(NonStringIndexOption.NotAnalyzed)
82+
)
83+
.Number(s => s
84+
.Name("DislikesCount")
85+
.Index(NonStringIndexOption.NotAnalyzed)
86+
)
87+
.Date(s => s
88+
.Name("Published")
89+
.Index(NonStringIndexOption.NotAnalyzed)
90+
)
91+
.Date(s => s
92+
.Name("CreatedDate")
93+
.Index(NonStringIndexOption.NotAnalyzed)
94+
)
95+
.String(s => s
96+
.Name("WatchLater")
97+
.Index(FieldIndexOption.NotAnalyzed)
98+
)
99+
.String(s => s
100+
.Name("Favourite")
101+
.Index(FieldIndexOption.NotAnalyzed)
102+
)
103+
.String(s => s
104+
.Name("Recommendations")
105+
.Index(FieldIndexOption.NotAnalyzed)
106+
)
107+
.Number(s => s
108+
.Name("TranscriptionStatus")
109+
.Index(NonStringIndexOption.NotAnalyzed)
110+
)
111+
.Number(s => s
112+
.Name("UploadSource")
113+
.Index(NonStringIndexOption.NotAnalyzed)
114+
)
115+
.Boolean(s => s
116+
.Name("FromProject")
117+
.Index(NonStringIndexOption.NotAnalyzed)
118+
)
119+
.Boolean(s => s
120+
.Name("IsSearchable")
121+
.Index(NonStringIndexOption.NotAnalyzed)
122+
)
123+
.MultiField(s => s
124+
.Name("NativeTranscription")
125+
.Fields(fs => fs
126+
.String(x => x.Name("NativeTranscription").Analyzer("english"))
127+
.String(
128+
y => y.Name(t => t.NativeTranscription.Suffix("folded")).Analyzer("folding")))
129+
130+
)
131+
.MultiField(s => s
132+
.Name("EnglishTranscription")
133+
.Fields(fs => fs
134+
.String(x => x.Name("EnglishTranscription").Analyzer("english"))
135+
.String(
136+
y => y.Name(t => t.EnglishTranscription.Suffix("folded")).Analyzer("folding")))
137+
138+
)
139+
.MultiField(s => s
140+
.Name("Tags")
141+
.Fields(fs => fs
142+
.String(x => x.Name("Tags").Analyzer("english"))
143+
.String(y => y.Name(t => t.Tags.Suffix("folded")).Analyzer("folding")))
144+
145+
)
146+
.MultiField(s => s
147+
.Name("Comments")
148+
.Fields(fs => fs
149+
.String(x => x.Name("Comments").Analyzer("english"))
150+
.String(y => y.Name(t => t.Comments.Suffix("folded")).Analyzer("folding")))
151+
152+
)
153+
.String(s => s
154+
.Name("ClientId")
155+
.Index(FieldIndexOption.NotAnalyzed)
156+
)
157+
)
158+
)
159+
);
160+
161+
var getMappingResult = client.GetMapping<ElasticVideo>(m => m
162+
.Index(index)
163+
.Type("video")
164+
);
165+
getMappingResult.Mapping.Properties.Should().NotContainKey("objectId");
166+
}
167+
}
168+
169+
public class ElasticSearchBaseEntity
170+
{
171+
public string ObjectId { get; set; }
172+
}
173+
174+
public class ElasticVideo : ElasticSearchBaseEntity
175+
{
176+
public string CountryOfOrigin { get; set; }
177+
public string LanguageOfOrigin { get; set; }
178+
public string Title { get; set; }
179+
public string TitleEnglish { get; set; }
180+
public string Description { get; set; }
181+
public string DescriptionEnglish { get; set; }
182+
public string VideoImage { get; set; }
183+
public int ViewCount { get; set; }
184+
public int LikesCount { get; set; }
185+
public int DislikesCount { get; set; }
186+
public DateTime? Published { get; set; }
187+
public DateTime? CreatedDate { get; set; }
188+
public List<string> WatchLater { get; set; }
189+
public List<string> Favourite { get; set; }
190+
public bool IsSearchable { get; set; }
191+
public bool FromProject { get; set; }
192+
public string NativeTranscription { get; set; }
193+
public string EnglishTranscription { get; set; }
194+
public List<string> Tags { get; set; }
195+
public List<string> Comments { get; set; }
196+
public List<string> Attributes { get; set; }
197+
public List<string> Recommendations { get; set; }
198+
public string ClientId { get; set; }
199+
200+
public ElasticVideo()
201+
{
202+
Tags = new List<string>();
203+
WatchLater = new List<string>();
204+
Favourite = new List<string>();
205+
Comments = new List<string>();
206+
Attributes = new List<string>();
207+
}
208+
}
209+
}

0 commit comments

Comments
 (0)