Skip to content

Commit 2aad145

Browse files
committed
Got pinnedretriever yaml to working state without cluster
1 parent eaee938 commit 2aad145

File tree

3 files changed

+98
-73
lines changed

3 files changed

+98
-73
lines changed

x-pack/plugin/search-business-rules/build.gradle

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,38 @@ base {
1515
dependencies {
1616
compileOnly project(path: xpackModule('core'))
1717
testImplementation(testArtifact(project(xpackModule('core'))))
18-
testImplementation project(":test:framework")
18+
testImplementation(testArtifact(project(':server')))
19+
20+
clusterModules project(':modules:mapper-extras')
21+
clusterModules project(xpackModule('search-business-rules'))
22+
clusterModules project(':modules:lang-painless')
23+
}
24+
25+
restResources {
26+
restApi {
27+
include '_common',
28+
'bulk',
29+
'cluster',
30+
'indices',
31+
'index',
32+
'search',
33+
'xpack'
34+
}
35+
restTests {
36+
includeXpack 'searchbusinessrules'
37+
}
38+
}
39+
40+
tasks.named("yamlRestTest") {
41+
usesDefaultDistribution("uses search business rules plugin")
42+
}
43+
44+
artifacts {
45+
restXpackTests(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
46+
}
47+
48+
testClusters.configureEach {
49+
testDistribution = 'DEFAULT'
50+
setting 'xpack.license.self_generated.type', 'trial'
51+
setting 'xpack.security.enabled', 'false'
1952
}

x-pack/plugin/search-business-rules/src/main/resources/META-INF/services/org.elasticsearch.features.FeatureSpecification

Lines changed: 0 additions & 8 deletions
This file was deleted.

x-pack/plugin/search-business-rules/src/yamlRestTest/resources/rest-api-spec/test/searchbusinessrules/10_pinned_retriever.yml

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ setup:
4949
- match: { hits.hits.2._id: doc3 }
5050
- match: { hits.hits.3._id: doc4 }
5151
- match: { hits.hits.4._id: doc5 }
52-
- is_true: { hits.hits.0._score > 1.0 }
53-
- is_true: { hits.hits.1._score > 1.0 }
54-
- is_true: { hits.hits.2._score <= 1.0 }
55-
- is_true: { hits.hits.3._score <= 1.0 }
56-
- is_true: { hits.hits.4._score <= 1.0 }
52+
- is_true: hits.hits.0._score > 1.0
53+
- is_true: hits.hits.1._score > 1.0
54+
- is_true: hits.hits.2._score <= 1.0
55+
- is_true: hits.hits.3._score <= 1.0
56+
- is_true: hits.hits.4._score <= 1.0
5757

5858
---
5959
"pinned retriever parameter variations":
@@ -76,11 +76,11 @@ setup:
7676
- match: { hits.total.value: 5 }
7777
- match: { hits.hits.0._id: doc1 }
7878
- match: { hits.hits.1._id: doc2 }
79-
- is_true: { hits.hits.0._score > 1.0 }
80-
- is_true: { hits.hits.1._score > 1.0 }
81-
- is_true: { hits.hits.2._score <= 1.0 }
82-
- is_true: { hits.hits.3._score <= 1.0 }
83-
- is_true: { hits.hits.4._score <= 1.0 }
79+
- is_true: hits.hits.0._score > 1.0
80+
- is_true: hits.hits.1._score > 1.0
81+
- is_true: hits.hits.2._score <= 1.0
82+
- is_true: hits.hits.3._score <= 1.0
83+
- is_true: hits.hits.4._score <= 1.0
8484

8585
- do:
8686
search:
@@ -96,11 +96,11 @@ setup:
9696

9797
- match: { hits.total.value: 5 }
9898
- match: { hits.hits.0._id: doc1 }
99-
- is_true: { hits.hits.0._score > 1.0 }
100-
- is_true: { hits.hits.1._score <= 1.0 }
101-
- is_true: { hits.hits.2._score <= 1.0 }
102-
- is_true: { hits.hits.3._score <= 1.0 }
103-
- is_true: { hits.hits.4._score <= 1.0 }
99+
- is_true: hits.hits.0._score > 1.0
100+
- is_true: hits.hits.1._score <= 1.0
101+
- is_true: hits.hits.2._score <= 1.0
102+
- is_true: hits.hits.3._score <= 1.0
103+
- is_true: hits.hits.4._score <= 1.0
104104

105105
- do:
106106
search:
@@ -118,11 +118,11 @@ setup:
118118

119119
- match: { hits.total.value: 5 }
120120
- match: { hits.hits.0._id: doc1 }
121-
- is_true: { hits.hits.0._score > 1.0 }
122-
- is_true: { hits.hits.1._score <= 1.0 }
123-
- is_true: { hits.hits.2._score <= 1.0 }
124-
- is_true: { hits.hits.3._score <= 1.0 }
125-
- is_true: { hits.hits.4._score <= 1.0 }
121+
- is_true: hits.hits.0._score > 1.0
122+
- is_true: hits.hits.1._score <= 1.0
123+
- is_true: hits.hits.2._score <= 1.0
124+
- is_true: hits.hits.3._score <= 1.0
125+
- is_true: hits.hits.4._score <= 1.0
126126

127127
---
128128
"pinned retriever with combined parameters":
@@ -144,11 +144,11 @@ setup:
144144
- match: { hits.total.value: 5 }
145145
- match: { hits.hits.0._id: doc1 }
146146
- match: { hits.hits.1._id: doc2 }
147-
- is_true: { hits.hits.0._score > 1.0 }
148-
- is_true: { hits.hits.1._score > 1.0 }
149-
- is_true: { hits.hits.2._score <= 1.0 }
150-
- is_true: { hits.hits.3._score <= 1.0 }
151-
- is_true: { hits.hits.4._score <= 1.0 }
147+
- is_true: hits.hits.0._score > 1.0
148+
- is_true: hits.hits.1._score > 1.0
149+
- is_true: hits.hits.2._score <= 1.0
150+
- is_true: hits.hits.3._score <= 1.0
151+
- is_true: hits.hits.4._score <= 1.0
152152

153153
- do:
154154
search:
@@ -172,11 +172,11 @@ setup:
172172
- match: { hits.hits.1._id: doc3 }
173173
- match: { hits.hits.2._id: doc2 }
174174
- match: { hits.hits.3._id: doc4 }
175-
- is_true: { hits.hits.0._score > 1.0 }
176-
- is_true: { hits.hits.1._score > 1.0 }
177-
- is_true: { hits.hits.2._score > 1.0 }
178-
- is_true: { hits.hits.3._score > 1.0 }
179-
- is_true: { hits.hits.4._score <= 1.0 }
175+
- is_true: hits.hits.0._score > 1.0
176+
- is_true: hits.hits.1._score > 1.0
177+
- is_true: hits.hits.2._score > 1.0
178+
- is_true: hits.hits.3._score > 1.0
179+
- is_true: hits.hits.4._score <= 1.0
180180

181181
---
182182
"pinned retriever combined with rrf":
@@ -213,10 +213,10 @@ setup:
213213
- match: { hits.total.value: 5 }
214214
- match: { hits.hits.0._id: doc1 }
215215
- match: { hits.hits.1._id: doc2 }
216-
- is_true: { hits.hits.0._score > 1.0 }
217-
- is_true: { hits.hits.1._score > 1.0 }
218-
- is_true: { hits.hits.2._score > hits.hits.3._score }
219-
- is_true: { hits.hits.3._score > hits.hits.4._score }
216+
- is_true: hits.hits.0._score > 1.0
217+
- is_true: hits.hits.1._score > 1.0
218+
- is_true: hits.hits.2._score > hits.hits.3._score
219+
- is_true: hits.hits.3._score > hits.hits.4._score
220220

221221
---
222222
"pinned retriever with pagination":
@@ -237,7 +237,7 @@ setup:
237237
- match: { hits.total.value: 5 }
238238
- length: { hits.hits: 1 }
239239
- match: { hits.hits.0._id: doc2 }
240-
- is_true: { hits.hits.0._score > 1.0 }
240+
- is_true: hits.hits.0._score > 1.0
241241

242242
---
243243
"pinned retriever as a sub-retriever":
@@ -270,11 +270,11 @@ setup:
270270
]
271271

272272
- match: { hits.total.value: 5 }
273-
- is_true: { hits.hits.0._score > 1.0 }
274-
- is_true: { hits.hits.1._score > 1.0 }
275-
- is_true: { hits.hits.2._score <= 1.0 }
276-
- is_true: { hits.hits.3._score <= 1.0 }
277-
- is_true: { hits.hits.4._score <= 1.0 }
273+
- is_true: hits.hits.0._score > 1.0
274+
- is_true: hits.hits.1._score > 1.0
275+
- is_true: hits.hits.2._score <= 1.0
276+
- is_true: hits.hits.3._score <= 1.0
277+
- is_true: hits.hits.4._score <= 1.0
278278

279279
---
280280
"pinned retriever with explicit sort on score":
@@ -294,11 +294,11 @@ setup:
294294
- match: { hits.total.value: 5 }
295295
- match: { hits.hits.0._id: doc1 }
296296
- match: { hits.hits.1._id: doc2 }
297-
- is_true: { hits.hits.0._score > 1.0 }
298-
- is_true: { hits.hits.1._score > 1.0 }
299-
- is_true: { hits.hits.2._score <= 1.0 }
300-
- is_true: { hits.hits.3._score <= 1.0 }
301-
- is_true: { hits.hits.4._score <= 1.0 }
297+
- is_true: hits.hits.0._score > 1.0
298+
- is_true: hits.hits.1._score > 1.0
299+
- is_true: hits.hits.2._score <= 1.0
300+
- is_true: hits.hits.3._score <= 1.0
301+
- is_true: hits.hits.4._score <= 1.0
302302

303303
---
304304
"pinned retriever with rank window size":
@@ -323,7 +323,7 @@ setup:
323323
- match: { hits.total.value: 5 }
324324
- length: { hits.hits: 1 }
325325
- match: { hits.hits.0._id: doc1 }
326-
- is_true: { hits.hits.0._score > 1.0 }
326+
- is_true: hits.hits.0._score > 1.0
327327

328328
- do:
329329
headers:
@@ -344,17 +344,15 @@ setup:
344344
- length: { hits.hits: 5 }
345345
- match: { hits.hits.0._id: doc1 }
346346
- match: { hits.hits.1._id: doc2 }
347-
- is_true: { hits.hits.0._score > 1.0 }
348-
- is_true: { hits.hits.1._score > 1.0 }
349-
- is_true: { hits.hits.2._score <= 1.0 }
350-
- is_true: { hits.hits.3._score <= 1.0 }
351-
- is_true: { hits.hits.4._score <= 1.0 }
347+
- is_true: hits.hits.0._score > 1.0
348+
- is_true: hits.hits.1._score > 1.0
349+
- is_true: hits.hits.2._score <= 1.0
350+
- is_true: hits.hits.3._score <= 1.0
351+
- is_true: hits.hits.4._score <= 1.0
352352

353353
---
354354
"pinned retriever explanation":
355355
- do:
356-
headers:
357-
Content-Type: application/json
358356
search:
359357
index: test-index1
360358
body:
@@ -368,16 +366,16 @@ setup:
368366
explain: true
369367

370368
- match: { hits.hits.0._id: doc1 }
371-
- is_true: { hits.hits.0._explanation.value > 1.0 }
372-
- is_true: { hits.hits.0._explanation.description: "pinned documents" }
373-
- is_true: { hits.hits.0._explanation.details.0.details.0.details.0.description: "pinned_by: [ids]" }
374-
- is_true: { hits.hits.0._explanation.details.0.details.0.details.1.description: "is_pinned: true" }
369+
- is_true: hits.hits.0._explanation.value > 1.0
370+
- match: { hits.hits.0._explanation.description: "pinned documents" }
371+
- match: { hits.hits.0._explanation.details.0.details.0.details.0.description: "pinned_by: [ids]" }
372+
- match: { hits.hits.0._explanation.details.0.details.0.details.1.description: "is_pinned: true" }
375373

376374
- match: { hits.hits.1._id: doc2 }
377-
- is_true: { hits.hits.1._explanation.value > 1.0 }
378-
- is_true: { hits.hits.1._explanation.description: "pinned documents" }
379-
- is_true: { hits.hits.1._explanation.details.0.details.0.details.0.description: "pinned_by: [ids]" }
380-
- is_true: { hits.hits.1._explanation.details.0.details.0.details.1.description: "is_pinned: true" }
375+
- is_true: hits.hits.1._explanation.value > 1.0
376+
- match: { hits.hits.1._explanation.description: "pinned documents" }
377+
- match: { hits.hits.1._explanation.details.0.details.0.details.0.description: "pinned_by: [ids]" }
378+
- match: { hits.hits.1._explanation.details.0.details.0.details.1.description: "is_pinned: true" }
381379

382380
---
383381
"pinned retriever with empty parameters":
@@ -415,14 +413,16 @@ setup:
415413
match_all: {}
416414

417415
- do:
418-
catch: /\[pinned\] Max of 100 ids exceeded: 101 provided./
416+
catch: /\[pinned\] Cannot specify both ids and docs parameters/
419417
search:
420418
index: test-index1
421419
body:
422420
retriever:
423421
pinned:
424-
ids: ["doc1"] * 101
422+
ids: ["doc1", "doc3"]
423+
docs: []
425424
retriever:
426425
standard:
427426
query:
428-
match_all: {}
427+
match_all: {}
428+

0 commit comments

Comments
 (0)