File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 66
66
Percolator ,
67
67
RangeField ,
68
68
RankFeature ,
69
+ RankFeatures ,
69
70
ScaledFloat ,
70
71
SearchAsYouType ,
71
72
Short ,
139
140
"RangeFacet" ,
140
141
"RangeField" ,
141
142
"RankFeature" ,
143
+ "RankFeatures" ,
142
144
"SF" ,
143
145
"ScaledFloat" ,
144
146
"Search" ,
Original file line number Diff line number Diff line change @@ -378,6 +378,10 @@ class RankFeature(Float):
378
378
name = "rank_feature"
379
379
380
380
381
+ class RankFeatures (Field ):
382
+ name = "rank_features"
383
+
384
+
381
385
class Integer (Field ):
382
386
name = "integer"
383
387
_coerce = True
Original file line number Diff line number Diff line change @@ -177,6 +177,11 @@ def test_constant_keyword():
177
177
assert f .to_dict () == {"type" : "constant_keyword" }
178
178
179
179
180
+ def test_rank_features ():
181
+ f = field .RankFeatures ()
182
+ assert f .to_dict () == {"type" : "rank_features" }
183
+
184
+
180
185
def test_object_dynamic_values ():
181
186
for dynamic in True , False , "strict" :
182
187
f = field .Object (dynamic = dynamic )
Original file line number Diff line number Diff line change 37
37
Nested ,
38
38
Object ,
39
39
Q ,
40
+ RankFeatures ,
40
41
Text ,
41
42
analyzer ,
42
43
)
@@ -52,6 +53,7 @@ class User(InnerDoc):
52
53
class Wiki (Document ):
53
54
owner = Object (User )
54
55
views = Long ()
56
+ ranked = RankFeatures ()
55
57
56
58
class Index :
57
59
name = "test-wiki"
@@ -204,7 +206,11 @@ def test_nested_top_hits_are_wrapped_properly(pull_request):
204
206
205
207
def test_update_object_field (write_client ):
206
208
Wiki .init ()
207
- w = Wiki (owner = User (name = "Honza Kral" ), _id = "elasticsearch-py" )
209
+ w = Wiki (
210
+ owner = User (name = "Honza Kral" ),
211
+ _id = "elasticsearch-py" ,
212
+ ranked = {"test1" : 0.1 , "topic2" : 0.2 },
213
+ )
208
214
w .save ()
209
215
210
216
assert "updated" == w .update (owner = [{"name" : "Honza" }, {"name" : "Nick" }])
@@ -215,6 +221,8 @@ def test_update_object_field(write_client):
215
221
assert w .owner [0 ].name == "Honza"
216
222
assert w .owner [1 ].name == "Nick"
217
223
224
+ assert w .ranked == {"test1" : 0.1 , "topic2" : 0.2 }
225
+
218
226
219
227
def test_update_script (write_client ):
220
228
Wiki .init ()
You can’t perform that action at this time.
0 commit comments