Skip to content

Commit d8fc416

Browse files
committed
fix #402 TermsExecution Enum was missing some members
1 parent e14fc75 commit d8fc416

File tree

5 files changed

+56
-45
lines changed

5 files changed

+56
-45
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ build/keys/keypair.snk
4242
/dep/Newtonsoft.Json.4.0.2
4343

4444
/src/Nest.Tests.Unit/*.ncrunchproject
45+
*.ncrunchproject

src/Nest.Tests.Integration/Mapping/MapTests.cs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ private void TestMapping(RootObjectMapping typeMapping)
4949
[Test]
5050
public void SimpleMapByAttributes()
5151
{
52-
this._client.DeleteMapping<ElasticSearchProject>();
53-
this._client.DeleteMapping<ElasticSearchProject>(ElasticsearchConfiguration.DefaultIndex + "_clone");
54-
var x = this._client.MapFromAttributes<ElasticSearchProject>();
52+
var index = ElasticsearchConfiguration.NewUniqueIndexName();
53+
var x = this._client.CreateIndex(index, s => s
54+
.AddMapping<ElasticSearchProject>(m => m.MapFromAttributes())
55+
);
56+
Assert.IsTrue(x.OK, x.ConnectionStatus.ToString());
5557
Assert.IsTrue(x.OK);
5658

57-
var typeMapping = this._client.GetMapping(ElasticsearchConfiguration.DefaultIndex, "elasticsearchprojects");
59+
var typeMapping = this._client.GetMapping(index, "elasticsearchprojects");
5860
TestMapping(typeMapping);
5961
}
6062

@@ -64,13 +66,15 @@ public void SimpleMapByAttributes()
6466
[Test]
6567
public void SimpleMapByAttributesUsingType()
6668
{
67-
var t = typeof(ElasticSearchProject);
68-
this._client.DeleteMapping(t);
69-
this._client.DeleteMapping(t, ElasticsearchConfiguration.DefaultIndex + "_clone");
70-
var x = this._client.MapFromAttributes(t);
71-
Assert.IsTrue(x.OK);
72-
73-
var typeMapping = this._client.GetMapping(ElasticsearchConfiguration.DefaultIndex, "elasticsearchprojects");
69+
var index = ElasticsearchConfiguration.NewUniqueIndexName();
70+
var x = this._client.CreateIndex(index, s => s
71+
72+
);
73+
Assert.IsTrue(x.OK, x.ConnectionStatus.ToString());
74+
var xx = this._client.MapFromAttributes(typeof(ElasticSearchProject), index);
75+
Assert.IsTrue(xx.OK);
76+
77+
var typeMapping = this._client.GetMapping(index, "elasticsearchprojects");
7478
TestMapping(typeMapping);
7579
}
7680

@@ -95,15 +99,17 @@ public void GetMappingOnNonExistingIndexType()
9599
[Test]
96100
public void DynamicMap()
97101
{
102+
var index = ElasticsearchConfiguration.NewUniqueIndexName();
103+
var x = this._client.CreateIndex(index, s => s);
104+
Assert.IsTrue(x.OK, x.ConnectionStatus.ToString());
98105
var typeMapping = this._client.GetMapping(ElasticsearchConfiguration.DefaultIndex, "elasticsearchprojects");
99106
var mapping = typeMapping.Properties["country"] as StringMapping;
100107
Assert.NotNull(mapping);
101108
mapping.Boost = 3;
102109
typeMapping.TypeNameMarker = "elasticsearchprojects2";
103-
this._client.Map(typeMapping, ElasticsearchConfiguration.DefaultIndex + "_clone");
110+
this._client.Map(typeMapping, index);
104111

105-
typeMapping = this._client.GetMapping(ElasticsearchConfiguration.DefaultIndex + "_clone",
106-
"elasticsearchprojects2");
112+
typeMapping = this._client.GetMapping(index, "elasticsearchprojects2");
107113
var countryMapping = typeMapping.Properties["country"] as StringMapping;
108114
Assert.NotNull(countryMapping);
109115
Assert.AreEqual(3, countryMapping.Boost);

src/Nest.Tests.Integration/Mapping/NotAnalyzedTest.cs

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@ public class NotAnalyzedTests : IntegrationTests
1010
[Test]
1111
public void NotAnalyzedReturnsOneItem()
1212
{
13-
this._client.DeleteMapping<ElasticSearchProject>();
14-
this._client.DeleteMapping<ElasticSearchProject>(ElasticsearchConfiguration.DefaultIndex + "_clone");
15-
this._client.CreateIndex(ElasticsearchConfiguration.DefaultIndex, new IndexSettings());
16-
var x = this._client.MapFromAttributes<ElasticSearchProject>();
13+
var index = ElasticsearchConfiguration.NewUniqueIndexName();
14+
var x = this._client.CreateIndex(index, s => s
15+
.AddMapping<ElasticSearchProject>(m=>m.MapFromAttributes())
16+
);
1717
Assert.IsTrue(x.OK, x.ConnectionStatus.ToString());
1818

19-
var typeMapping = this._client.GetMapping(ElasticsearchConfiguration.DefaultIndex, "elasticsearchprojects");
19+
var typeMapping = this._client.GetMapping(index, "elasticsearchprojects");
2020
var mapping = typeMapping.Properties["country"] as StringMapping;
2121
Assert.NotNull(mapping);
2222
Assert.AreEqual(FieldIndexOption.not_analyzed, mapping.Index);
2323

2424
var indexResult = this._client.Index(new ElasticSearchProject
2525
{
2626
Country = "The Royal Kingdom Of The Netherlands"
27-
}, new IndexParameters { Refresh = true });
27+
}, indexParameters: new IndexParameters { Refresh = true }, index: index);
2828
Assert.IsTrue(indexResult.IsValid);
2929

3030
var result = this._client.Search<ElasticSearchProject>(s=>s
31+
.Index(index)
3132
.FacetTerm(ft=>ft.OnField(f=>f.Country))
3233
.MatchAll()
3334
);
@@ -37,27 +38,30 @@ public void NotAnalyzedReturnsOneItem()
3738
}
3839

3940
[Test]
40-
public void AnalyzedReturnsTwoItems()
41+
public void AnalyzedReturnsMoreItems()
4142
{
42-
this._client.DeleteMapping<ElasticSearchProject>();
43-
var x = this._client.MapFromAttributes<ElasticSearchProject>();
44-
Assert.IsTrue(x.OK);
45-
46-
var typeMapping = this._client.GetMapping(ElasticsearchConfiguration.DefaultIndex, "elasticsearchprojects");
47-
this._client.DeleteMapping<ElasticSearchProject>();
48-
var mapping = typeMapping.Properties["country"] as StringMapping;
49-
Assert.NotNull(mapping);
50-
mapping.Index = FieldIndexOption.analyzed;
51-
var updateMapResult = this._client.Map(typeMapping);
52-
Assert.True(updateMapResult.IsValid);
43+
var index = ElasticsearchConfiguration.NewUniqueIndexName();
44+
var x = this._client.CreateIndex(index, s => s
45+
.AddMapping<ElasticSearchProject>(m => m
46+
.MapFromAttributes()
47+
.Properties(pp=>pp
48+
.String(pps=>pps.Name(p=>p.Country).Index(FieldIndexOption.analyzed))
49+
)
50+
)
51+
);
52+
Assert.IsTrue(x.OK, x.ConnectionStatus.ToString());
5353

54-
var indexResult = this._client.Index(new ElasticSearchProject
55-
{
56-
Country = "The Royal Kingdom Of The Netherlands"
57-
}, new IndexParameters { Refresh = true });
54+
var indexResult = this._client.Index(
55+
new ElasticSearchProject
56+
{
57+
Country = "The Royal Kingdom Of The Netherlands"
58+
},
59+
indexParameters: new IndexParameters { Refresh = true }
60+
, index: index);
5861
Assert.IsTrue(indexResult.IsValid);
5962

6063
var result = this._client.Search<ElasticSearchProject>(s => s
64+
.Index(index)
6165
.FacetTerm(ft => ft.OnField(f => f.Country))
6266
.MatchAll()
6367
);

src/Nest.Tests.Integration/Warmers/IndicesWarmersTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ public class IndicesWarmersTests : IntegrationTests
1414
[Test]
1515
public void CreateIndexWithWarmer()
1616
{
17-
var index = ElasticsearchConfiguration.DefaultIndex + "_clone";
18-
if (this._client.IndexExists(index).Exists)
19-
this._client.DeleteIndex(index);
17+
var index = ElasticsearchConfiguration.NewUniqueIndexName();
2018

2119
var result = this._client.CreateIndex(index, c => c
2220
.NumberOfReplicas(0)

src/Nest/Enums/TermsExecution.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
namespace Nest
1010
{
11-
public enum TermsExecution
12-
{
13-
plain,
14-
@bool,
15-
and
16-
}
11+
public enum TermsExecution
12+
{
13+
plain,
14+
@bool,
15+
and,
16+
or,
17+
fielddata
18+
}
1719
}

0 commit comments

Comments
 (0)