Skip to content

Commit ec9561f

Browse files
authored
Update doc examples (#4160)
This commit updates the examples generation to use the JSON reference file. * Update examples * Implement additional examples * regenerate example hash files
1 parent 4b88180 commit ec9561f

File tree

534 files changed

+7854
-4681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

534 files changed

+7854
-4681
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line11 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/BulkPage.cs#L8-L43.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var bulkResponse = client.Bulk(b => b
11+
.Index<object>(i => i
12+
.Index("test")
13+
.Id("1")
14+
.Document(new { field1 = "value1" })
15+
)
16+
.Delete<object>(d => d
17+
.Index("test")
18+
.Id("2")
19+
)
20+
.Create<object>(c => c
21+
.Index("test")
22+
.Id("3")
23+
.Document(new { field1 = "value3" })
24+
)
25+
.Update<object>(u => u
26+
.Index("test")
27+
.Id("1")
28+
.Doc(new { field2 = "value2" })
29+
)
30+
);
31+
----
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line502 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L319-L358.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var searchResponse = client.Search<Tweet>(s => s
11+
.Index("twitter")
12+
.Size(0)
13+
.FilterPath(new[] { "hits.total" }) //<1>
14+
.Query(q => q
15+
.Range(r => r
16+
.Field(f => f.Likes)
17+
.LessThan(10)
18+
)
19+
)
20+
);
21+
----
22+
<1> Using filter path can result in a response that cannot be parsed by the client's serializer. In these cases, using the low level client and parsing the JSON response may be preferred.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line658 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L396-L406.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var cancelTaskResponse = client.Tasks.Cancel(t => t
11+
.TaskId("r1A2WoRbTwKZ516z6NEs5A:36619")
12+
);
13+
----
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line412 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L150-L226.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var deleteByQueryResponse = client.DeleteByQuery<Tweet>(d => d
11+
.Index("twitter")
12+
.Slice(s => s
13+
.Id(0)
14+
.Max(2)
15+
)
16+
.Query(q => q
17+
.Range(r => r
18+
.Field(f => f.Likes)
19+
.LessThan(10)
20+
)
21+
)
22+
);
23+
24+
var deleteByQueryResponse2 = client.DeleteByQuery<Tweet>(d => d
25+
.Index("twitter")
26+
.Slice(s => s
27+
.Id(1)
28+
.Max(2)
29+
)
30+
.Query(q => q
31+
.Range(r => r
32+
.Field(f => f.Likes)
33+
.LessThan(10)
34+
)
35+
)
36+
);
37+
----
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line584 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L373-L384.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var listTasksResponse = client.Tasks.List(t => t
11+
.Detailed()
12+
.Actions("*/delete/byquery")
13+
);
14+
----
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line447 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L228-L277.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var refreshResponse = client.Indices.Refresh();
11+
12+
var searchResponse = client.Search<Tweet>(s => s
13+
.Index("twitter")
14+
.Size(0)
15+
.FilterPath(new[] { "hits.total" }) //<1>
16+
.Query(q => q
17+
.Range(r => r
18+
.Field(f => f.Likes)
19+
.LessThan(10)
20+
)
21+
)
22+
);
23+
----
24+
<1> Using filter path can result in a response that cannot be parsed by the client's serializer. In these cases, using the low level client and parsing the JSON response may be preferred.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line570 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L360-L371.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var rethrottleResponse = client.DeleteByQueryRethrottle("r1A2WoRbTwKZ516z6NEs5A:36619",
11+
r => r
12+
.RequestsPerSecond(-1)
13+
);
14+
----
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line485 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L279-L317.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var deleteByQueryResponse = client.DeleteByQuery<Tweet>(d => d
11+
.Index("twitter")
12+
.Refresh()
13+
.Slices(5)
14+
.Query(q => q
15+
.Range(r => r
16+
.Field(f => f.Likes)
17+
.LessThan(10)
18+
)
19+
)
20+
);
21+
----
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line638 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L386-L394.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var getTaskResponse = client.Tasks.GetTask("r1A2WoRbTwKZ516z6NEs5A:36619");
11+
----
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
////
2+
IMPORTANT NOTE
3+
==============
4+
This file is generated from method Line360 in https://github.com/elastic/elasticsearch-net/tree/master/src/Examples/Examples/Docs/DeleteByQueryPage.cs#L64-L80.
5+
If you wish to submit a PR to change this example, please change the source method above
6+
and run dotnet run -- asciidoc in the ExamplesGenerator project directory.
7+
////
8+
[source, csharp]
9+
----
10+
var deleteByQueryResponse = client.DeleteByQuery<object>(d => d
11+
.Index("twitter,blog")
12+
.Query(q => q.MatchAll())
13+
);
14+
----

0 commit comments

Comments
 (0)