Skip to content

Commit

Permalink
Fixed incorrect and inconsistent variable name in .NET documentation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
NickFane authored Jun 29, 2020
1 parent 07bc8b6 commit 274edae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ to `Routing` which can infer the correct routing key based on the JoinField prop

[source,csharp]
----
var ndexResponse = client.Index(parent, i => i.Routing(Routing.From(parent)));
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
var indexResponse = client.Index(parent, i => i.Routing(Routing.From(parent)));
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
----

The same goes for when we index a child, we can pass the instance directly to `Routing` and NEST will use the parent id
Expand All @@ -273,23 +273,23 @@ create an instance of `Routing`

[source,csharp]
----
ndexResponse = client.Index(child, i => i.Routing(Route(child)));
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
indexResponse = client.Index(child, i => i.Routing(Route(child)));
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
----

You can always override the default inferred routing though

[source,csharp]
----
ndexResponse = client.Index(child, i => i.Routing("explicit"));
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=explicit");
indexResponse = client.Index(child, i => i.Routing("explicit"));
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=explicit");
ndexResponse = client.Index(child, i => i.Routing(null));
ndexResponse.ApiCall.Uri.Query.Should().NotContain("routing");
indexResponse = client.Index(child, i => i.Routing(null));
indexResponse.ApiCall.Uri.Query.Should().NotContain("routing");
var indexRequest = new IndexRequest<MyChild>(child) { Routing = Route(child) } ;
ndexResponse = client.Index(indexRequest);
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
indexResponse = client.Index(indexRequest);
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
----

Its important to note that the routing is resolved at request time, not instantiation time
Expand All @@ -298,8 +298,8 @@ here we update the `child`'s `JoinField` after already creating the index reques
[source,csharp]
----
child.MyJoinField = JoinField.Link<MyChild>(parentId: "something-else");
ndexResponse = client.Index(indexRequest);
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=something-else");
indexResponse = client.Index(indexRequest);
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=something-else");
----

[NOTE]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,34 +278,34 @@ public void Inference()
* here we index `parent` and rather than fishing out the parent id by inspecting `parent` we just pass the instance
* to `Routing` which can infer the correct routing key based on the JoinField property on the instance
*/
var ndexResponse = client.Index(parent, i => i.Routing(Routing.From(parent)));
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
var indexResponse = client.Index(parent, i => i.Routing(Routing.From(parent)));
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");

/**
* The same goes for when we index a child, we can pass the instance directly to `Routing` and NEST will use the parent id
* already specified on `child`. Here we use the static import `using static Nest.Infer` and it's `Route()` static method to
* create an instance of `Routing`
*/
ndexResponse = client.Index(child, i => i.Routing(Route(child)));
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
indexResponse = client.Index(child, i => i.Routing(Route(child)));
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");

/** You can always override the default inferred routing though */
ndexResponse = client.Index(child, i => i.Routing("explicit"));
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=explicit");
indexResponse = client.Index(child, i => i.Routing("explicit"));
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=explicit");

ndexResponse = client.Index(child, i => i.Routing(null));
ndexResponse.ApiCall.Uri.Query.Should().NotContain("routing");
indexResponse = client.Index(child, i => i.Routing(null));
indexResponse.ApiCall.Uri.Query.Should().NotContain("routing");

var indexRequest = new IndexRequest<MyChild>(child) { Routing = Route(child) } ;
ndexResponse = client.Index(indexRequest);
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
indexResponse = client.Index(indexRequest);
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=1337");
/**
* Its important to note that the routing is resolved at request time, not instantiation time
* here we update the `child`'s `JoinField` after already creating the index request for `child`
*/
child.MyJoinField = JoinField.Link<MyChild>(parentId: "something-else");
ndexResponse = client.Index(indexRequest);
ndexResponse.ApiCall.Uri.Query.Should().Contain("routing=something-else");
indexResponse = client.Index(indexRequest);
indexResponse.ApiCall.Uri.Query.Should().Contain("routing=something-else");
}
/** [NOTE]
* --
Expand Down

0 comments on commit 274edae

Please sign in to comment.