Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set RequestParameters anymore #8415

Open
gpetrou opened this issue Nov 20, 2024 · 2 comments
Open

Cannot set RequestParameters anymore #8415

gpetrou opened this issue Nov 20, 2024 · 2 comments

Comments

@gpetrou
Copy link
Contributor

gpetrou commented Nov 20, 2024

Elastic.Clients.Elasticsearch version: 8.16.0

Elasticsearch version: 8.12.2

.NET runtime version: 8.0

Operating system version:

Description of the problem including expected versus actual behavior:
In previous versions, we were able to pass RequestParameters in ElasticsearchClient.Transport.RequestAsync method.
It seems that we cannot do that anymore. According to the release notes there were some changes to the Transport library, but once again, it is unclear what to do about them.

Steps to reproduce:

UpdateDocumentRequestParameters : RequestParameters
{
    public Refresh Refresh
    {
        get => Q<Refresh>("refresh");
        init => Q("refresh", value);
    }
}
UpdateDocumentRequestParameters updateDocumentRequestParameters = new()
{
    Refresh = refresh
};

StringResponse response = await _elasticsearchClient.Transport.RequestAsync<StringResponse>(
    Elastic.Transport.HttpMethod.POST,
    $"{indexName}/_update/{id}",
    PostData.String(postData),
    updateDocumentRequestParameters,
    cancellationToken).ConfigureAwait(false);

How are we supposed to convert such code?

Expected behavior

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):

@gpetrou gpetrou added 8.x Relates to 8.x client version Category: Bug labels Nov 20, 2024
@flobernd
Copy link
Member

Hi @gpetrou,

UpdateDocumentRequestParameters updateDocumentRequestParameters = new()
{
    Refresh = refresh
};

var pathAndQuery = updateDocumentRequestParameters.CreatePathWithQueryStrings($"{indexName}/_update/{id}",
    _elasticsearchClient.ElasticsearchClientSettings);
var endpointPath = new EndpointPath(Elastic.Transport.HttpMethod.POST, pathAndQuery);

var response = await client.Transport
    .RequestAsync<StringResponse>(
        endpointPath,
        PostData.String(""),
        null,
        null,
        default)
    .ConfigureAwait(false);

Copy link
Contributor

This issue is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 2 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants