-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Getting rid of some of the hairy parts in NEST part 1/2 #349
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…xplicitly marking (I)Dictionary's to not use the propertynameresolver for its keys
…arate camelcase and non camelcase indexersettings WHOOHOO
…ionSettings no longer exposed directly
…obally so that Dictionaries on objects we index behave like we expect them too
…e how NEST handles unspecified propertynames without supplying your own JsonContractResolver
Mpdreamz
added a commit
that referenced
this pull request
Sep 20, 2013
Getting rid of some of the hairy parts in NEST part 1/2
Mpdreamz
added a commit
that referenced
this pull request
Sep 20, 2013
…sponse, everything flows to Deserialize noticed after writing PR notes for #349
You might want to update the documentation on Azure to clarify that .TryConnect and .IsValid is no longer supported. (http://nest.azurewebsites.net/concepts/connecting.html) |
@paradigmshifted You should send him a pull request :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NEST is pretty old the first commit was in 2010! 2010-10-07T09:32:05-07:00 to be exact, thats only 8 months after elasticsearch's first commit 2010-02-08T05:22:27-08:00 for those who are wandering.
This PR is about getting rid of some of the fluff gathered in the past three years.
Serialization
Back when NEST first started serializing JSON.NET left dictionary keys alone but in between version 4.0r1 and 4.0r2 of Json.NET this changed (for more info see: http://json.codeplex.com/workitem/20923)
At the time I "solved" this by having two serializers one that does camelCasing and one that doesn't. This was a bad bad mistake on my part as it created a very confusing codebase as to when to use which serializationsettings.
This PR finally rectifies this and introduces
ElasticSerializer
with only oneSerialize
and oneDeserialize<T>
method.Because of this we can now write this:
or go even more low level:
RawClient
Not technically part of this commit as i already pushed it to master but the past example shows how NEST will now seperate the Raw calls to elastic search using a .Raw property which exposes a IRawElasticClient (which you can ofcourse
new
as well if thats all you need`.The cool thing is that this rawclient is automatically generated from scanning all the REST endpoints in the elasticsearch source code so it should be fairly easy to keep it up to date.
This means that all the
*Raw()
methods onIElasticClient
are now gone.Property name handling
You can now finally hook into how NEST should handle unspecified propertynames, meaning those not marked with an
[ElasticProperty(Name="")]
or(I)Dictionary<T,K>
properties who should be treated verbatim by calling:On
ConnectionSettings
.Sayanora .IsValid and .TryConnect(), hello .RootNodeInfo()
The first 2 features of ElasticClient I wrote nearly three years ago which seemed like a good idea at the time. TryConnect() and .IsValid() are two confusing ways to check if your node is up,
RootNodeInfo()
now returns a mapped response of the info elasticsearch returns when you hit a node at the root (version, lucene_version etc), or you can callclient.Raw.MainGet()
or perhaps even betterclient.Raw.MainHead()
or evenclient.Connection.HeadSync("/")
.You catch my drift: with so many ways of querying the root
.IsValid
andTryConnect()
is just fluff that only introduces confusion.Next up: (AKA part 2)
Not part of this PR but serves as a heads up of coming changes
PathResolver
This class is used to make all the url endpoints, since we have IRawClient now which already has all the urls in it this class needs to go. Instead descriptors should be responsible for returning the querystring parameters.
All the calls on IElasticClient should then use the IRawClient instead of going directly to IConnection.
Missing Async Methods on IElasticClient
Not all the methods on IElasticClient have an Async counterpart.