IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Transport example
editTransport example
editThis page demonstrates how to use the low level transport to send requests.
public class MyRequestParameters : RequestParameters { public bool Pretty { get => Q<bool>("pretty"); init => Q("pretty", value); } } // ... var body = """ { "name": "my-api-key", "expiration": "1d", "...": "..." } """; MyRequestParameters requestParameters = new() { Pretty = true }; var pathAndQuery = requestParameters.CreatePathWithQueryStrings("/_security/api_key", client.ElasticsearchClientSettings); var endpointPath = new EndpointPath(Elastic.Transport.HttpMethod.POST, pathAndQuery); // Or, if the path does not contain query parameters: // new EndpointPath(Elastic.Transport.HttpMethod.POST, "my_path") var response = await client.Transport .RequestAsync<StringResponse>( endpointPath, PostData.String(body), null, null, cancellationToken: default) .ConfigureAwait(false);