Skip to content

Commit ced7334

Browse files
committed
update documentation
1 parent 77d469a commit ced7334

File tree

3 files changed

+47
-7
lines changed

3 files changed

+47
-7
lines changed

docs/analysis/token-filters/token-filter-usage.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ InitializerExample
183183
"ngram": {
184184
"type": "ngram",
185185
"min_gram": 3,
186-
"max_gram": 30
186+
"max_gram": 4
187187
},
188188
"pc": {
189189
"type": "pattern_capture",
@@ -207,7 +207,7 @@ InitializerExample
207207
"shing": {
208208
"type": "shingle",
209209
"min_shingle_size": 8,
210-
"max_shingle_size": 12,
210+
"max_shingle_size": 10,
211211
"output_unigrams": true,
212212
"output_unigrams_if_no_shingles": true,
213213
"token_separator": "|",

docs/client-concepts/high-level/mapping/visitor-pattern-mapping.asciidoc

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ please modify the original csharp file found at the link and submit the PR with
1717

1818
It is also possible to apply a transformation on all or specific properties.
1919

20-
`.AutoMap()` internally implements the https://en.wikipedia.org/wiki/Visitor_pattern[visitor pattern].
21-
The default visitor, `NoopPropertyVisitor`, does nothing and acts as a blank canvas for you
20+
`.AutoMap()` internally implements the https://en.wikipedia.org/wiki/Visitor_pattern[visitor pattern].
21+
The default visitor, `NoopPropertyVisitor`, does nothing and acts as a blank canvas for you
2222
to implement your own visiting methods.
2323

2424
For instance, let's create a custom visitor that disables doc values for numeric and boolean types
@@ -133,7 +133,7 @@ var expected = new
133133
==== Visiting on PropertyInfo
134134

135135
You can even take the visitor approach a step further, and instead of visiting on `IProperty` types, visit
136-
directly on your POCO reflected `PropertyInfo` properties.
136+
directly on your POCO reflected `PropertyInfo` properties.
137137

138138
As an example, let's create a visitor that maps all CLR types to an Elasticsearch text datatype `ITextProperty`).
139139

@@ -183,3 +183,43 @@ var descriptor = new CreateIndexDescriptor("myindex")
183183
}
184184
----
185185

186+
==== Skip properties
187+
188+
Through implementing `SkipProperty` on the visitor you can prevent certain properties from being mapped
189+
190+
[source,csharp]
191+
----
192+
public class DictionaryDocument : SortedDictionary<string, dynamic>
193+
{
194+
public int Id { get; set; }
195+
}
196+
197+
public class IgnoreInheritedPropertiesVisitor<T> : NoopPropertyVisitor
198+
{
199+
public override bool SkipProperty(PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute)
200+
{
201+
return propertyInfo?.DeclaringType != typeof(T);
202+
}
203+
}
204+
205+
var descriptor = new CreateIndexDescriptor("myindex")
206+
.Mappings(ms => ms
207+
.Map<DictionaryDocument>(m => m.AutoMap(new IgnoreInheritedPropertiesVisitor<DictionaryDocument>()))
208+
);
209+
----
210+
211+
[source,javascript]
212+
----
213+
{
214+
"mappings": {
215+
"dictionarydocument": {
216+
"properties": {
217+
"id": {
218+
"type": "integer"
219+
}
220+
}
221+
}
222+
}
223+
}
224+
----
225+

docs/query-dsl/joining/has-parent/has-parent-query-usage.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ new HasParentQuery
3838
{
3939
Name = "named_query",
4040
Boost = 1.1,
41-
Type = Infer.Type<Developer>(),
41+
ParentType = Infer.Type<Developer>(),
4242
InnerHits = new InnerHits { Explain = true },
4343
Query = new MatchAllQuery(),
4444
Score = true,
@@ -53,7 +53,7 @@ new HasParentQuery
5353
"has_parent": {
5454
"_name": "named_query",
5555
"boost": 1.1,
56-
"type": "developer",
56+
"parent_type": "developer",
5757
"score": true,
5858
"ignore_unmapped": true,
5959
"query": {

0 commit comments

Comments
 (0)