File tree Expand file tree Collapse file tree 2 files changed +97
-1
lines changed
aggregations/bucket/geo-hash-grid
query-dsl/specialized/rank-feature Expand file tree Collapse file tree 2 files changed +97
-1
lines changed Original file line number Diff line number Diff line change @@ -65,3 +65,63 @@ var myGeoHashGrid = response.Aggregations.GeoHash("my_geohash_grid");
6565myGeoHashGrid.Should().NotBeNull();
6666----
6767
68+ ==== Fluent DSL example
69+
70+ [source,csharp]
71+ ----
72+ a => a
73+ .GeoHash("my_geohash_grid", g => g
74+ .Field(p => p.LocationPoint)
75+ .Bounds(b => b
76+ .TopLeft(90,-180)
77+ .BottomRight(-90, 180)
78+ )
79+ )
80+ ----
81+
82+ ==== Object Initializer syntax example
83+
84+ [source,csharp]
85+ ----
86+ new GeoHashGridAggregation("my_geohash_grid")
87+ {
88+ Field = Field<Project>(p => p.LocationPoint),
89+ Bounds = new BoundingBox
90+ {
91+ TopLeft = new GeoLocation(90, -180),
92+ BottomRight = new GeoLocation(-90, 180)
93+ }
94+ }
95+ ----
96+
97+ [source,javascript]
98+ .Example json output
99+ ----
100+ {
101+ "my_geohash_grid": {
102+ "geohash_grid": {
103+ "field": "locationPoint",
104+ "bounds": {
105+ "top_left": {
106+ "lat": 90.0,
107+ "lon": -180.0
108+ },
109+ "bottom_right": {
110+ "lat": -90.0,
111+ "lon": 180.0
112+ }
113+ }
114+ }
115+ }
116+ }
117+ ----
118+
119+ ==== Handling Responses
120+
121+ [source,csharp]
122+ ----
123+ response.ShouldBeValid();
124+ var myGeoHashGrid = response.Aggregations.GeoHash("my_geohash_grid");
125+ myGeoHashGrid.Should().NotBeNull();
126+ ----
127+
Original file line number Diff line number Diff line change 4444new RankFeatureQuery()
4545{
4646 Name = "named_query",
47- Boost = 1.1,
47+ Boost = 1.1,
4848 Field = Infer.Field<Project>(f => f.Rank),
4949 Function = new RankFeatureSaturationFunction()
5050}
@@ -63,3 +63,39 @@ new RankFeatureQuery()
6363}
6464----
6565
66+ ==== Fluent DSL example
67+
68+ [source,csharp]
69+ ----
70+ q
71+ .RankFeature(rf => rf
72+ .Name("named_query")
73+ .Boost(1.1)
74+ .Field(f => f.Rank)
75+ )
76+ ----
77+
78+ ==== Object Initializer syntax example
79+
80+ [source,csharp]
81+ ----
82+ new RankFeatureQuery
83+ {
84+ Name = "named_query",
85+ Boost = 1.1,
86+ Field = Infer.Field<Project>(f => f.Rank),
87+ }
88+ ----
89+
90+ [source,javascript]
91+ .Example json output
92+ ----
93+ {
94+ "rank_feature": {
95+ "_name": "named_query",
96+ "boost": 1.1,
97+ "field": "rank"
98+ }
99+ }
100+ ----
101+
You can’t perform that action at this time.
0 commit comments