First prerelease of 7.x .NET clients
This is the first alpha prerelease of the client with support for Elasticsearch 7.x to Nuget.
The intention in releasing this package now is to elicit feedback from the community on some of the larger changes that have already gone into the 7.x branch, prior to putting out a GA release. Some of the large changes include:
#3493 Change internal serializer to Utf8Json
Following discussion and research with replacing Json.NET as the internal serializer, a fork of Utf8Json is source included into Elasticsearch.NET, replacing both the lowlevel serializer based on SimpleJson, and the high level serializer based on Json.NET. Early research indicated about a 2x performance improvement in serialization.
All unit tests and integration tests are passing with this new serializer, but there are some known existing features of the client that will not yet work:
-
#3654 JSON serialization is never indented, even if
SerializationFormatting.Indented
is specifiedThe serialization routines generated by Utf8Json never generate
IJsonFormatter<T>
that will indent JSON, for performance reasons. We expect to implement this feature in a later release. -
#3655 NEST types cannot be extended by inheritance
With NEST 6.x, additional properties can be included for a type by deriving from that type and annotating these new properties. With the current implementation of serialization with Utf8Json, this approach will not work. We expect to implement this in a later release.
-
Serializer uses
Reflection.Emit
Utf8Json uses
Reflection.Emit
to generate efficient formatters for serializing types that it sees.Reflection.Emit
is not supported on all platforms e.g. UWP, Xamarin.iOS, Xamarin.Android. -
Elasticsearch.Net.DynamicResponse
deserializes JSON arrays toList<object>
SimpleJson deserialized JSON arrays to object[]
, but Utf8Json deserializes them to List<object>
. We believe that that the change to returning List<object>
would be preferred for allocation and performance reasons.
#3658 Removal of high level to low level dispatcher
In 6.x, the process of an API call within NEST looked roughly like
client.Search()
=> Dispatch()
=> LowLevelDispatch.SearchDispatch()
=> lowlevelClient.Search()
=> lowlevelClient.DoRequest()
With 7.x, this process has been changed to remove dispatching to the low level client methods and the middle layer. The new process looks like
client.Search()
=> lowlevelClient.DoRequest()
This means that in the high level client IRequest
now does it own url building, with the upside that the call chain is smaller and allocates a fewer lambda closures. The downside is that there are now 2 url building mechanisms, one in the low level client and a new one in the high level client, but we think this trade off is worth it.
#3213 Refactor geo_shape
queries and geoshapes
Support for geo_shape
queries has existed in NEST for a long time, but each geoshape had its own query type and API method to use to make a geo_shape
query. With 7.x, these have all been refactored into one query, GeoShapeQuery
, that accepts an IGeoShape
, the shape to use within the query.
Feedback
We would love to get feedback from folks trying out the 7.0.0-alpha1 release of the client. If you come across an exception or bug, please open an issue to discuss.