|
| 1 | +:ref_current: https://www.elastic.co/guide/en/elasticsearch/reference/7.4 |
| 2 | + |
| 3 | +:github: https://github.com/elastic/elasticsearch-net |
| 4 | + |
| 5 | +:nuget: https://www.nuget.org/packages |
| 6 | + |
| 7 | +//// |
| 8 | +IMPORTANT NOTE |
| 9 | +============== |
| 10 | +This file has been generated from https://github.com/elastic/elasticsearch-net/tree/7.x/src/Tests/Tests/ClientConcepts/LowLevel/LowLevelResponseTypes.doc.cs. |
| 11 | +If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file, |
| 12 | +please modify the original csharp file found at the link and submit the PR with that change. Thanks! |
| 13 | +//// |
| 14 | + |
| 15 | +[[low-level-response-types]] |
| 16 | +=== Low Level Client Response Types |
| 17 | + |
| 18 | +[source,csharp] |
| 19 | +---- |
| 20 | +return @"{ |
| 21 | +""boolean"" : true, |
| 22 | +""string"" : ""v"", |
| 23 | +""number"" : 29, |
| 24 | +""array"" : [1, 2, 3, 4], |
| 25 | +""object"" : { |
| 26 | + ""first"" : ""value1"", |
| 27 | + ""second"" : ""value2"", |
| 28 | + ""nested"" : { ""x"" : ""value3"" } |
| 29 | +}, |
| 30 | +""array_of_objects"" : [ |
| 31 | + { |
| 32 | + ""first"" : ""value11"", |
| 33 | + ""second"" : ""value12"", |
| 34 | + ""nested"" : { ""x"" : ""value4"" } |
| 35 | + }, |
| 36 | + { |
| 37 | + ""first"" : ""value21"", |
| 38 | + ""second"" : ""value22"", |
| 39 | + ""nested"" : { ""x"" : ""value5"" }, |
| 40 | + ""complex.nested"" : { ""x"" : ""value6"" } |
| 41 | + } |
| 42 | +] |
| 43 | + }"; |
| 44 | +---- |
| 45 | + |
| 46 | +[float] |
| 47 | +=== DynamicResponse |
| 48 | + |
| 49 | +[source,csharp] |
| 50 | +---- |
| 51 | +var response = Client.LowLevel.Search<DynamicResponse>(PostData.Empty); |
| 52 | +
|
| 53 | +response.Get<string>("object.first").Should() |
| 54 | + .NotBeEmpty() |
| 55 | + .And.Be("value1"); |
| 56 | +
|
| 57 | +response.Get<string>("object._arbitrary_key_").Should() |
| 58 | + .NotBeEmpty() |
| 59 | + .And.Be("first"); |
| 60 | +
|
| 61 | +response.Get<int>("array.1").Should().Be(2); |
| 62 | +response.Get<long>("array.1").Should().Be(2); |
| 63 | +response.Get<long>("number").Should().Be(29); |
| 64 | +response.Get<long?>("number").Should().Be(29); |
| 65 | +response.Get<long?>("number_does_not_exist").Should().Be(null); |
| 66 | +response.Get<long?>("number").Should().Be(29); |
| 67 | +
|
| 68 | +response.Get<string>("array_of_objects.1.second").Should() |
| 69 | + .NotBeEmpty() |
| 70 | + .And.Be("value22"); |
| 71 | +
|
| 72 | +response.Get<string>("array_of_objects.1.complex\\.nested.x").Should() |
| 73 | + .NotBeEmpty() |
| 74 | + .And.Be("value6"); |
| 75 | +---- |
| 76 | + |
0 commit comments