Skip to content

Commit 8c511c8

Browse files
committed
trying to reproduce #319 in an integration test
1 parent 5eb670d commit 8c511c8

File tree

3 files changed

+52
-9
lines changed

3 files changed

+52
-9
lines changed

Diff for: src/Nest.Tests.Integration/Reproduce/ReproduceTests.cs renamed to src/Nest.Tests.Integration/Reproduce/Reproduce211Tests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Nest.Tests.Integration.Reproduce
1313
/// tests to reproduce reported errors
1414
/// </summary>
1515
[TestFixture]
16-
public class ReproduceTests : IntegrationTests
16+
public class Reproduce211Tests : IntegrationTests
1717
{
1818
public class Post
1919
{
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Nest.Tests.MockData;
5+
using Nest.Tests.MockData.Domain;
6+
using NUnit.Framework;
7+
using System.Diagnostics;
8+
using FluentAssertions;
9+
10+
namespace Nest.Tests.Integration.Reproduce
11+
{
12+
/// <summary>
13+
/// tests to reproduce reported errors
14+
/// </summary>
15+
[TestFixture]
16+
public class Reproduce319Tests : IntegrationTests
17+
{
18+
19+
/// <summary>
20+
/// https://github.com/Mpdreamz/NEST/issues/319
21+
/// </summary>
22+
[Test]
23+
public void CreateIndexShouldNotThrowNullReference()
24+
{
25+
var settings = new IndexSettings();
26+
settings.Similarity = new SimilaritySettings();
27+
settings.NumberOfReplicas = 1;
28+
settings.NumberOfShards = 5;
29+
settings.Add("index.refresh_interval", "10s");
30+
settings.Add("merge.policy.merge_factor", "10");
31+
settings.Add("search.slowlog.threshold.fetch.warn", "1s");
32+
settings.Analysis.Analyzers.Add(new KeyValuePair<string, AnalyzerBase>("keyword", new KeywordAnalyzer()));
33+
settings.Analysis.Analyzers.Add(new KeyValuePair<string, AnalyzerBase>("simple", new SimpleAnalyzer()));
34+
35+
Assert.DoesNotThrow(() =>
36+
{
37+
var idxRsp = this._client.CreateIndex(ElasticsearchConfiguration.NewUniqueIndexName(), settings);
38+
Assert.IsTrue(idxRsp.IsValid, idxRsp.ConnectionStatus.ToString());
39+
});
40+
}
41+
42+
}
43+
}

Diff for: src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class ElasticPropertyAttribute : Attribute, IElasticPropertyAttribute
88
public bool AddSortField { get; set; }
99

1010
public bool OptOut { get; set; }
11-
11+
1212
public string Name { get; set; }
1313

1414
public FieldType Type { get; set; }
@@ -22,7 +22,7 @@ public class ElasticPropertyAttribute : Attribute, IElasticPropertyAttribute
2222
public string IndexAnalyzer { get; set; }
2323
public string SearchAnalyzer { get; set; }
2424
public string NullValue { get; set; }
25-
public string Similarity { get; set; }
25+
public string Similarity { get; set; }
2626

2727
public bool OmitNorms { get; set; }
2828
public bool OmitTermFrequencyAndPositions { get; set; }
@@ -44,16 +44,16 @@ public ElasticPropertyAttribute()
4444
{
4545
//make sure we match ES's defaults
4646
this.Boost = 1;
47-
this.TermVector = TermVectorOption.no;
47+
this.TermVector = TermVectorOption.no;
4848
this.Index = FieldIndexOption.analyzed;
49-
49+
5050
this.IncludeInAll = true;
5151
this.PrecisionStep = 4;
5252
}
5353

54-
public void Accept(IElasticPropertyVisitor visitor)
55-
{
56-
visitor.Visit(this);
57-
}
54+
public void Accept(IElasticPropertyVisitor visitor)
55+
{
56+
visitor.Visit(this);
57+
}
5858
}
5959
}

0 commit comments

Comments
 (0)