Skip to content

Commit 79ebad0

Browse files
committed
Remove multiple types per index from documentation
Closes #3138
1 parent 3bba963 commit 79ebad0

File tree

4 files changed

+170
-311
lines changed

4 files changed

+170
-311
lines changed

.paket/Paket.Restore.targets

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
</PropertyGroup>
5454

5555
<!-- If shasum and awk exist get the hashes -->
56-
<Exec Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
56+
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
5757
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
5858
</Exec>
59-
<Exec Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
59+
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
6060
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
6161
</Exec>
6262

src/Tests/ClientConcepts/HighLevel/Mapping/AttributeMapping.doc.cs

+40-72
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,16 @@ namespace Tests.ClientConcepts.HighLevel.Mapping
2626
* When you use attributes, you *must* also call `.AutoMap()` for the attributes to be applied.
2727
* --
2828
*
29-
* Here we define the same two types as before, but this time using attributes to define the mappings.
29+
* Here we define an `Employee` type and use attributes to define the mappings.
3030
*/
3131
public class AttributeMapping
3232
{
3333
private IElasticClient client = TestClient.GetInMemoryClient(c => c.DisableDirectStreaming());
3434

35-
[ElasticsearchType(Name = "company")]
36-
public class Company
37-
{
38-
[Keyword(NullValue = "null", Similarity = "BM25")]
39-
public string Name { get; set; }
40-
41-
[Text(Name = "office_hours")]
42-
public TimeSpan? HeadOfficeHours { get; set; }
43-
44-
[Object(Store = false)]
45-
public List<Employee> Employees { get; set; }
46-
}
47-
4835
[ElasticsearchType(Name = "employee")]
4936
public class Employee
5037
{
51-
[Text(Name = "first_name")]
38+
[Text(Name = "first_name", Norms = false, Similarity = "LMDirichlet")]
5239
public string FirstName { get; set; }
5340

5441
[Text(Name = "last_name")]
@@ -66,15 +53,29 @@ public class Employee
6653
[Nested]
6754
[PropertyName("empl")]
6855
public List<Employee> Employees { get; set; }
56+
57+
[Text(Name = "office_hours")]
58+
public TimeSpan? OfficeHours { get; set; }
59+
60+
[Object(Store = false)]
61+
public List<Skill> Skills { get; set; }
6962
}
7063

64+
public class Skill
65+
{
66+
[Text]
67+
public string Name { get; set; }
68+
69+
[Number(NumberType.Byte, Name = "level")]
70+
public int Proficiency { get; set; }
71+
}
72+
7173
/**Then we map the types by calling `.AutoMap()` */
7274
[U]
7375
public void UsingAutoMapWithAttributes()
7476
{
7577
var createIndexResponse = client.CreateIndex("myindex", c => c
7678
.Mappings(ms => ms
77-
.Map<Company>(m => m.AutoMap())
7879
.Map<Employee>(m => m.AutoMap())
7980
)
8081
);
@@ -86,61 +87,6 @@ public void UsingAutoMapWithAttributes()
8687
{
8788
mappings = new
8889
{
89-
company = new
90-
{
91-
properties = new
92-
{
93-
employees = new
94-
{
95-
properties = new
96-
{
97-
birthday = new
98-
{
99-
format = "MMddyyyy",
100-
type = "date"
101-
},
102-
empl = new
103-
{
104-
properties = new {},
105-
type = "nested"
106-
},
107-
first_name = new
108-
{
109-
type = "text"
110-
},
111-
isManager = new
112-
{
113-
null_value = false,
114-
store = true,
115-
type = "boolean"
116-
},
117-
last_name = new
118-
{
119-
type = "text"
120-
},
121-
salary = new
122-
{
123-
coerce = true,
124-
doc_values = false,
125-
ignore_malformed = true,
126-
type = "float"
127-
}
128-
},
129-
type = "object",
130-
store = false
131-
},
132-
name = new
133-
{
134-
null_value = "null",
135-
similarity = "BM25",
136-
type = "keyword"
137-
},
138-
office_hours = new
139-
{
140-
type = "text"
141-
}
142-
}
143-
},
14490
employee = new
14591
{
14692
properties = new
@@ -157,7 +103,9 @@ public void UsingAutoMapWithAttributes()
157103
},
158104
first_name = new
159105
{
160-
type = "text"
106+
type = "text",
107+
norms = false,
108+
similarity = "LMDirichlet"
161109
},
162110
isManager = new
163111
{
@@ -169,12 +117,32 @@ public void UsingAutoMapWithAttributes()
169117
{
170118
type = "text"
171119
},
120+
office_hours = new
121+
{
122+
type = "text"
123+
},
172124
salary = new
173125
{
174126
coerce = true,
175127
doc_values = false,
176128
ignore_malformed = true,
177129
type = "float"
130+
},
131+
skills = new
132+
{
133+
properties = new
134+
{
135+
level = new
136+
{
137+
type = "byte"
138+
},
139+
name = new
140+
{
141+
type = "text"
142+
}
143+
},
144+
type = "object",
145+
store = false
178146
}
179147
}
180148
}

0 commit comments

Comments
 (0)