Skip to content

Commit f2b92f7

Browse files
committed
Update from main
2 parents 907eb2b + f9426a4 commit f2b92f7

22 files changed

+276
-73
lines changed

.github/workflows/docfx.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: 'CD'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
target_branch:
7+
description: 'The target branch to which the documentation should be pushed to.'
8+
type: 'string'
9+
required: true
10+
name:
11+
description: 'The name to use for the documentation folder (defaults to the name of the current ref)'
12+
type: 'string'
13+
required: false
14+
default: ${{ github.ref_name }}
15+
16+
concurrency:
17+
group: 'docfx'
18+
cancel-in-progress: false
19+
20+
env:
21+
# Configuration
22+
GLOBAL_JSON_FILE: 'global.json'
23+
CACHE_PATTERNS: '["**/*.[cf]sproj*", "**/*.Build.props"]'
24+
# .NET SDK related environment variables
25+
DOTNET_NOLOGO: 1
26+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
27+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
28+
DOTNET_GENERATE_ASPNET_CERTIFICATE: 0
29+
30+
jobs:
31+
docfx:
32+
name: 'DocFx'
33+
runs-on: 'ubuntu-latest'
34+
steps:
35+
- name: 'Checkout'
36+
uses: 'actions/checkout@v4'
37+
38+
- name: '.NET Setup'
39+
uses: 'actions/setup-dotnet@v4'
40+
with:
41+
global-json-file: '${{ github.workspace }}/${{ env.GLOBAL_JSON_FILE }}'
42+
43+
- name: 'DocFX Setup'
44+
run: |-
45+
dotnet tool update -g docfx
46+
47+
# TODO: Remove 'stack'
48+
- name: '.NET Cache Packages'
49+
uses: 'actions/cache@v4'
50+
with:
51+
path: '~/.nuget/packages'
52+
key: '${{ runner.os }}-nuget-stack-${{ hashFiles(fromJson(env.CACHE_PATTERNS)) }}'
53+
restore-keys: '${{ runner.os }}-nuget-stack-'
54+
55+
- name: 'DocFx Build'
56+
working-directory: 'docfx'
57+
run: |-
58+
docfx docfx.json
59+
mv ./_site ./../..
60+
61+
- name: 'Checkout'
62+
uses: 'actions/checkout@v4'
63+
with:
64+
ref: ${{ inputs.target_branch }}
65+
66+
- name: 'Commit'
67+
run: |-
68+
rm -r "./${{ inputs.name }}" || true
69+
mv ../_site "./${{ inputs.name }}"
70+
git config --global user.name '${{ github.actor }}'
71+
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
72+
git add -A
73+
git commit -am "Add ${{ inputs.name }}"
74+
git push

.github/workflows/docfx_manual.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'DocFx'
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
docfx:
8+
name: 'DocFx'
9+
uses: ./.github/workflows/docfx.yml
10+
with:
11+
target_branch: 'refdoc'
12+
secrets: 'inherit'

.github/workflows/release_stack.yml

+9
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,12 @@ jobs:
1616
release_tag: ${{ github.event.release.tag_name }}
1717
release_body: ${{ github.event.release.body }}
1818
secrets: 'inherit'
19+
20+
docfx:
21+
name: 'DocFx'
22+
if: ${{ !startsWith(github.event.release.tag_name, 'serverless-') }}
23+
uses: ./.github/workflows/docfx.yml
24+
with:
25+
name: ${{ github.event.release.tag_name }}
26+
target_branch: 'refdoc'
27+
secrets: 'inherit'

Elasticsearch.sln

+7-15
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{362B2776
1515
tests\Directory.Build.props = tests\Directory.Build.props
1616
EndProjectSection
1717
EndProject
18-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "tests\Tests\Tests.csproj", "{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}"
19-
EndProject
2018
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Core", "tests\Tests.Core\Tests.Core.csproj", "{70225C3F-393A-40F5-A778-8FF71A38C4C0}"
2119
EndProject
2220
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Configuration", "tests\Tests.Configuration\Tests.Configuration.csproj", "{587DE66B-6FAB-4722-9C53-2812BEFB6A44}"
@@ -61,6 +59,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.Clients.Elasticsear
6159
EndProject
6260
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.Clients.Elasticsearch.Serverless", "src\Elastic.Clients.Elasticsearch.Serverless\Elastic.Clients.Elasticsearch.Serverless.csproj", "{49D7F5A7-AA32-492B-B957-0E3325861F55}"
6361
EndProject
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "tests\Tests\Tests.csproj", "{6FD804B2-CE80-41CB-A411-2023F34C18FE}"
63+
EndProject
6464
Global
6565
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6666
Debug|Any CPU = Debug|Any CPU
@@ -71,18 +71,6 @@ Global
7171
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
7272
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
7373
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}.Release|Any CPU.Build.0 = Release|Any CPU
74-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
76-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|x64.ActiveCfg = Debug|Any CPU
77-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|x64.Build.0 = Debug|Any CPU
78-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|x86.ActiveCfg = Debug|Any CPU
79-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|x86.Build.0 = Debug|Any CPU
80-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
81-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Release|Any CPU.Build.0 = Release|Any CPU
82-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Release|x64.ActiveCfg = Release|Any CPU
83-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Release|x64.Build.0 = Release|Any CPU
84-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Release|x86.ActiveCfg = Release|Any CPU
85-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Release|x86.Build.0 = Release|Any CPU
8674
{70225C3F-393A-40F5-A778-8FF71A38C4C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8775
{70225C3F-393A-40F5-A778-8FF71A38C4C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
8876
{70225C3F-393A-40F5-A778-8FF71A38C4C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -123,13 +111,16 @@ Global
123111
{49D7F5A7-AA32-492B-B957-0E3325861F55}.Debug|Any CPU.Build.0 = Debug|Any CPU
124112
{49D7F5A7-AA32-492B-B957-0E3325861F55}.Release|Any CPU.ActiveCfg = Release|Any CPU
125113
{49D7F5A7-AA32-492B-B957-0E3325861F55}.Release|Any CPU.Build.0 = Release|Any CPU
114+
{6FD804B2-CE80-41CB-A411-2023F34C18FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
115+
{6FD804B2-CE80-41CB-A411-2023F34C18FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
116+
{6FD804B2-CE80-41CB-A411-2023F34C18FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
117+
{6FD804B2-CE80-41CB-A411-2023F34C18FE}.Release|Any CPU.Build.0 = Release|Any CPU
126118
EndGlobalSection
127119
GlobalSection(SolutionProperties) = preSolution
128120
HideSolutionNode = FALSE
129121
EndGlobalSection
130122
GlobalSection(NestedProjects) = preSolution
131123
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7}
132-
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E} = {362B2776-4B29-46AB-B237-56776B5372B6}
133124
{70225C3F-393A-40F5-A778-8FF71A38C4C0} = {362B2776-4B29-46AB-B237-56776B5372B6}
134125
{587DE66B-6FAB-4722-9C53-2812BEFB6A44} = {362B2776-4B29-46AB-B237-56776B5372B6}
135126
{0B4DCA79-10CC-4CB8-95D3-A4EB8C98BE1C} = {362B2776-4B29-46AB-B237-56776B5372B6}
@@ -140,6 +131,7 @@ Global
140131
{F6162603-D134-4121-8106-2BA4DAD7350B} = {362B2776-4B29-46AB-B237-56776B5372B6}
141132
{8C9275D9-29CE-4A20-8FD5-6B26C6CAAADB} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7}
142133
{49D7F5A7-AA32-492B-B957-0E3325861F55} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7}
134+
{6FD804B2-CE80-41CB-A411-2023F34C18FE} = {362B2776-4B29-46AB-B237-56776B5372B6}
143135
EndGlobalSection
144136
GlobalSection(ExtensibilityGlobals) = postSolution
145137
SolutionGuid = {CE74F821-B001-4C69-A58D-CF81F8B0B632}

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Please refer to
5858
[the full documentation on elastic.co](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html)
5959
for comprehensive information on installation, configuration and usage.
6060

61+
The API reference documentation is available [here](https://elastic.github.io/elasticsearch-net).
62+
6163
## Versions
6264

6365
### Elasticsearch 8.x Clusters

docfx/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_site
2+
api

docfx.json renamed to docfx/docfx.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{
44
"src": [
55
{
6-
"src": "./src/Elastic.Clients.Elasticsearch",
6+
"src": "../src",
77
"files": [
8-
"**/*.csproj"
8+
"**/Elastic.Clients.Elasticsearch.csproj"
99
]
1010
}
1111
],
@@ -38,6 +38,7 @@
3838
"globalMetadata": {
3939
"_appName": "Elasticsearch.NET",
4040
"_appTitle": "Elasticsearch.NET",
41+
"_appLogoPath": "images/logo.svg",
4142
"_enableSearch": true,
4243
"_disableContribution": true,
4344
"pdf": false

docfx/images/logo.svg

+16
Loading

docfx/index.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
_layout: landing
3+
---
4+
5+
# Elasticsearch .NET API
6+
7+
This is the home of the Elasticsearch .NET Client API Reference Documentation.
8+
9+
Please click on `API` in the top menu to get to the API overview.

docfx/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- name: API
2+
href: api/

docs/migration-guide.asciidoc

+38-8
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,43 @@ As a last resort, the low-level client `Elastic.Transport` can be used to create
292292

293293
[source,csharp]
294294
----
295+
public class MyRequestParameters : RequestParameters
296+
{
297+
public bool Pretty
298+
{
299+
get => Q<bool>("pretty");
300+
init => Q("pretty", value);
301+
}
302+
}
303+
304+
// ...
305+
295306
var body = """
296-
{
297-
"name": "my-api-key",
298-
"expiration": "1d",
299-
"...": "..."
300-
}
301-
""";
302-
303-
var response = await client.Transport.RequestAsync<StringResponse>(HttpMethod.POST, "/_security/api_key", PostData.String(body));
307+
{
308+
"name": "my-api-key",
309+
"expiration": "1d",
310+
"...": "..."
311+
}
312+
""";
313+
314+
MyRequestParameters requestParameters = new()
315+
{
316+
Pretty = true
317+
};
318+
319+
var pathAndQuery = requestParameters.CreatePathWithQueryStrings("/_security/api_key",
320+
client.ElasticsearchClientSettings);
321+
var endpointPath = new EndpointPath(Elastic.Transport.HttpMethod.POST, pathAndQuery);
322+
323+
// Or, if the path does not contain query parameters:
324+
// new EndpointPath(Elastic.Transport.HttpMethod.POST, "my_path")
325+
326+
var response = await client.Transport
327+
.RequestAsync<StringResponse>(
328+
endpointPath,
329+
PostData.String(body),
330+
null,
331+
null,
332+
cancellationToken: default)
333+
.ConfigureAwait(false);
304334
----

docs/usage/index.asciidoc

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The sections below provide tutorials on the most frequently used and some less o
66

77
For a full reference, see the {ref}/[Elasticsearch documentation] and in particular the {ref}/rest-apis.html[REST APIs] section. The {net-client} follows closely the JSON structures described there.
88

9+
A .NET API reference documentation for the Elasticsearch client package is available https://elastic.github.io/elasticsearch-net[here].
10+
911
If you're new to {es}, make sure also to read {ref}/getting-started.html[Elasticsearch's quick start] that provides a good introduction.
1012

1113
* <<recommendations, Usage recommendations>>
@@ -14,9 +16,10 @@ If you're new to {es}, make sure also to read {ref}/getting-started.html[Elastic
1416

1517
NOTE: This is still a work in progress, more sections will be added in the near future.
1618

17-
include::recommendations.asciidoc[]
19+
include::aggregations.asciidoc[]
20+
include::esql.asciidoc[]
1821
include::examples.asciidoc[]
19-
include::query.asciidoc[]
2022
include::mappings.asciidoc[]
21-
include::aggregations.asciidoc[]
22-
include::esql.asciidoc[]
23+
include::query.asciidoc[]
24+
include::recommendations.asciidoc[]
25+
include::transport.asciidoc[]

docs/usage/transport.asciidoc

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[[transport]]
2+
== Transport example
3+
4+
This page demonstrates how to use the low level transport to send requests.
5+
6+
[source,csharp]
7+
----
8+
public class MyRequestParameters : RequestParameters
9+
{
10+
public bool Pretty
11+
{
12+
get => Q<bool>("pretty");
13+
init => Q("pretty", value);
14+
}
15+
}
16+
17+
// ...
18+
19+
var body = """
20+
{
21+
"name": "my-api-key",
22+
"expiration": "1d",
23+
"...": "..."
24+
}
25+
""";
26+
27+
MyRequestParameters requestParameters = new()
28+
{
29+
Pretty = true
30+
};
31+
32+
var pathAndQuery = requestParameters.CreatePathWithQueryStrings("/_security/api_key",
33+
client.ElasticsearchClientSettings);
34+
var endpointPath = new EndpointPath(Elastic.Transport.HttpMethod.POST, pathAndQuery);
35+
36+
// Or, if the path does not contain query parameters:
37+
// new EndpointPath(Elastic.Transport.HttpMethod.POST, "my_path")
38+
39+
var response = await client.Transport
40+
.RequestAsync<StringResponse>(
41+
endpointPath,
42+
PostData.String(body),
43+
null,
44+
null,
45+
cancellationToken: default)
46+
.ConfigureAwait(false);
47+
----

src/Elastic.Clients.Elasticsearch.Serverless/Core/ElasticsearchClientProductRegistration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public class ApiVersionMetaHeaderProducer : MetaHeaderProducer
7777

7878
public override string HeaderName => "Elastic-Api-Version";
7979

80-
public override string ProduceHeaderValue(RequestData requestData, bool isAsync) => _apiVersion;
80+
public override string ProduceHeaderValue(BoundConfiguration boundConfiguration, bool isAsync) => _apiVersion;
8181

8282
public ApiVersionMetaHeaderProducer(VersionInfo version)
8383
{

src/Elastic.Clients.Elasticsearch.Serverless/Elastic.Clients.Elasticsearch.Serverless.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Nullable>annotations</Nullable>
2222
</PropertyGroup>
2323
<ItemGroup>
24-
<PackageReference Include="Elastic.Transport" Version="0.5.2" />
24+
<PackageReference Include="Elastic.Transport" Version="0.5.7" />
2525
</ItemGroup>
2626
<ItemGroup>
2727
<InternalsVisibleTo Include="Tests" Key="$(ExposedPublicKey)" />

src/Elastic.Clients.Elasticsearch/Elastic.Clients.Elasticsearch.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Nullable>annotations</Nullable>
2222
</PropertyGroup>
2323
<ItemGroup>
24-
<PackageReference Include="Elastic.Transport" Version="0.5.2" />
24+
<PackageReference Include="Elastic.Transport" Version="0.5.7" />
2525
</ItemGroup>
2626
<ItemGroup>
2727
<InternalsVisibleTo Include="Tests" Key="$(ExposedPublicKey)" />

src/Elastic.Clients.Elasticsearch/_Shared/Api/Esql/EsqlQueryRequest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Elastic.Clients.Elasticsearch.Esql;
1717

1818
internal sealed class EsqlResponseBuilder : TypedResponseBuilder<EsqlQueryResponse>
1919
{
20-
protected override EsqlQueryResponse? Build(ApiCallDetails apiCallDetails, RequestData requestData,
20+
protected override EsqlQueryResponse? Build(ApiCallDetails apiCallDetails, BoundConfiguration boundConfiguration,
2121
Stream responseStream,
2222
string contentType, long contentLength)
2323
{
@@ -38,7 +38,7 @@ static byte[] BytesFromStream(Stream stream)
3838
}
3939
}
4040

41-
protected override async Task<EsqlQueryResponse?> BuildAsync(ApiCallDetails apiCallDetails, RequestData requestData,
41+
protected override async Task<EsqlQueryResponse?> BuildAsync(ApiCallDetails apiCallDetails, BoundConfiguration boundConfiguration,
4242
Stream responseStream,
4343
string contentType, long contentLength, CancellationToken cancellationToken = default)
4444
{

0 commit comments

Comments
 (0)