.NET NEST 7.17.5 and Elastic Version 9.0.2

Hello everyone,

We have been using the NEST .NET package to connect to Elastic and make calls/searches.
Current situation:
.NET Nest 7.17.5
Elastic version 8.16.3.

To maintain compatibility, we are using the following option when initialising the ElasticClient:

            var pool = new StaticConnectionPool(new[] { xxx });

            var settings = new ConnectionSettings(pool)
                .DefaultFieldNameInferrer(p => p)
                .DisableDirectStreaming()
                .ThrowExceptions(false)
                .MaximumRetries(3)
                .EnableApiVersioningHeader(); // we use this property for compatibility

            var client = new Nest.ElasticClient(settings);

We just got a cluster with an Elastic 9.0.2 version on it today. I wanted to check whether our .NET Nest client is compatible with this version.
I have noticed that removing the .EnableApiVersioningHeader() property allows me to index documents and perform searches.
Using the property throws an exception.

The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product. Call: Status code 400 from: GET /
---> Elasticsearch.Net.PipelineException: The client is unable to verify that the server is Elasticsearch due to an unsuccessful product check call. Some functionality may not be compatible if the server is running an unsupported product.

Due to the complexity of the project and the large amount of custom logic used, it is not currently possible to upgrade to the newest ElasticClient in the short term.

In general, is NEST 7 compatible with ES 9? If so, is the EnableApiVersioningHeader property still needed?

Thanks in advance
Best regards

Hi @urbanjasmine ,

I'm sorry, but NEST (v7) is not compatible with Elasticsearch 9 (see compatiblity matrix):

Given a constant major version of the client, each related minor version is compatible with its equivalent- and all later Elasticsearch minor versions of the same or next higher major version.

We released a few blog posts about NEST in the past:

To summarize:

NEST is already deprecated since already ~1 year. The lifetime has been extended until end of this year, but after that point, we won't even release security fixes.

For this reason I would highly recommend you to start with the migration. NEST and Elastic.Clients.Elasticsearch can be used side-by-side in the same project which allows you to gradually upgrade parts of your solution.

I have noticed that removing the .EnableApiVersioningHeader() property allows me to index documents and perform searches.

If the header is missing, the server assumes a client of the same major version (9) and disables the compatibility layer.

Since NEST is not really compatible with 9.x, this will cause unexpected behavior. We won't provide any support in this case (see also: Client hardcodes Accept header version with no override, breaking compatibility with older Elasticsearch servers · Issue #8526 · elastic/elasticsearch-net · GitHub).

1 Like