elastic/elasticsearch-net

Unable to open PIT

Closed this issue ยท 4 comments

Elastic.Clients.Elasticsearch version: 8.19.11

Elasticsearch version: 8.2.2

.NET runtime version: 9.0

Operating system version: Windows 10 Pro (22h2 build 19045.4412)

Description of the problem including expected versus actual behavior:
I'm trying to open PIT like this:

var esClient = new ElasticsearchClient(
    new ElasticsearchClientSettings(
        new StaticNodePool(new List<Uri> { new("https://esnode1:9200"), new("https://esnode2:9200") })
    ).RequestTimeout(TimeSpan.FromSeconds(60))
    .Authentication(new BasicAuthentication("login", "pass"))
    .ServerCertificateValidationCallback((o, certificate, chain, errors) => true)
    .ServerCertificateValidationCallback(CertificateValidations.AllowAll)
);

var response = esClient.OpenPointInTime(new OpenPointInTimeRequest(Indices.Index("myindex")) { KeepAlive = "1m" });

The response is 400 status with message: "request [POST /myindex/_pit] does not support having a body".
What am I doing wrong?

The Low Level Transport allows to open a PIT:

var response = client.Transport.Post<StringResponse>("myindex/_pit?keep_alive=1m", null);

But I couldn't do it with the OpenPointInTime method.

Hi @usefull ,

Your Elasticsearch 8.2.2 server rejects the body for the PIT request since it was only added to Elasticsearch 8.12: elastic/elasticsearch#102388.

Unfortunately this is a case where this part of the README applies:

Language clients are also backward compatible across minor versions within the same major version (without strong guarantees)

From the technical side there is nothing I can do about it since the client is stateless and does not change behavior depending on the server version.

Btw.: ES 8.2 is also no longer supported. It might be worth upgrading your server in the near future ๐Ÿ™‚

Thanks for the clarification.

Anytime! The workaround you proposed should work fine btw. until you upgrade ๐Ÿ™‚