-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tests] Move templated _rank_eval tests (#30679)
This change moves the ranking evaluation tests that use templates to the existing yml rest tests instead of extending ESIntegTestCase. Closes #30628
- Loading branch information
Christoph Büscher
authored
May 24, 2018
1 parent
2b8d3e8
commit 9cb6b90
Showing
4 changed files
with
171 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 0 additions & 159 deletions
159
...ith-mustache/src/test/java/org/elasticsearch/index/rankeval/SmokeMultipleTemplatesIT.java
This file was deleted.
Oops, something went wrong.
171 changes: 171 additions & 0 deletions
171
...-with-mustache/src/test/resources/rest-api-spec/test/rank-eval/10_rank_eval_templated.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
setup: | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
number_of_shards: 1 | ||
- do: | ||
index: | ||
index: test | ||
type: _doc | ||
id: 1 | ||
body: { "text": "berlin", "title" : "Berlin, Germany" } | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: _doc | ||
id: 2 | ||
body: { "text": "amsterdam" } | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: _doc | ||
id: 3 | ||
body: { "text": "amsterdam" } | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: _doc | ||
id: 4 | ||
body: { "text": "amsterdam" } | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: _doc | ||
id: 5 | ||
body: { "text": "amsterdam" } | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: _doc | ||
id: 6 | ||
body: { "text": "amsterdam" } | ||
|
||
- do: | ||
indices.refresh: {} | ||
|
||
--- | ||
"Basic rank-eval request with template": | ||
|
||
- skip: | ||
version: " - 6.1.99" | ||
reason: the ranking evaluation feature is available since 6.2 | ||
|
||
- do: | ||
rank_eval: | ||
body: { | ||
"templates": [ { "id": "match", "template": {"source": "{\"query\": { \"match\" : {\"text\" : \"{{query_string}}\" }}}" }} ], | ||
"requests" : [ | ||
{ | ||
"id": "amsterdam_query", | ||
"params": { "query_string": "amsterdam" }, | ||
"template_id": "match", | ||
"ratings": [ | ||
{"_index": "test", "_id": "2", "rating": 1}, | ||
{"_index": "test", "_id": "3", "rating": 1}, | ||
{"_index": "test", "_id": "4", "rating": 1}, | ||
{"_index": "test", "_id": "5", "rating": 1},] | ||
}, | ||
{ | ||
"id" : "berlin_query", | ||
"params": { "query_string": "berlin" }, | ||
"template_id": "match", | ||
"ratings": [{"_index": "test", "_id": "1", "rating": 1}] | ||
} | ||
], | ||
"metric" : { "precision": { }} | ||
} | ||
|
||
- match: {quality_level: 0.9} | ||
- match: {details.amsterdam_query.unknown_docs.0._id: "6"} | ||
|
||
--- | ||
"Test illegal request parts": | ||
|
||
- do: | ||
catch: /Query in rated requests should not contain aggregations./ | ||
rank_eval: | ||
body: { | ||
"templates": [ { "id": "match", "template": {"source": "{ \"aggs\" : { \"avg_grade\" : { \"avg\" : { \"field\" : \"grade\" }}}}" }} ], | ||
"requests" : [ | ||
{ | ||
"id": "amsterdam_query", | ||
"params": { "query_string": "amsterdam" }, | ||
"template_id": "match", | ||
"ratings": [] | ||
} | ||
], | ||
"metric" : { "precision": { }} | ||
} | ||
|
||
- do: | ||
catch: /Query in rated requests should not contain a suggest section./ | ||
rank_eval: | ||
body: { | ||
"templates": [ { "id": "match", "template": {"source": "{\"suggest\" : {\"my-suggestion\" : {\"text\" : \"Elastic\",\"term\" : {\"field\" : \"message\"}}}}" }} ], | ||
"requests" : [ | ||
{ | ||
"id": "amsterdam_query", | ||
"params": { "query_string": "amsterdam" }, | ||
"template_id": "match", | ||
"ratings": [] | ||
} | ||
], | ||
"metric" : { "precision": { }} | ||
} | ||
|
||
- do: | ||
catch: /Query in rated requests should not contain a highlighter section./ | ||
rank_eval: | ||
body: { | ||
"templates": [ { "id": "match", "template": {"source": "{\"highlight\" : { \"fields\" : {\"content\" : {}}}}" }} ], | ||
"requests" : [ | ||
{ | ||
"id": "amsterdam_query", | ||
"params": { "query_string": "amsterdam" }, | ||
"template_id": "match", | ||
"ratings": [] | ||
} | ||
], | ||
"metric" : { "precision": { }} | ||
} | ||
|
||
- do: | ||
catch: /Query in rated requests should not use profile./ | ||
rank_eval: | ||
body: { | ||
"templates": [ { "id": "match", "template": {"source": "{\"profile\" : \"true\" }" }} ], | ||
"requests" : [ | ||
{ | ||
"id": "amsterdam_query", | ||
"params": { "query_string": "amsterdam" }, | ||
"template_id": "match", | ||
"ratings": [] | ||
} | ||
], | ||
"metric" : { "precision": { }} | ||
} | ||
|
||
- do: | ||
catch: /Query in rated requests should not use explain./ | ||
rank_eval: | ||
body: { | ||
"templates": [ { "id": "match", "template": {"source": "{\"explain\" : \"true\" }" }} ], | ||
"requests" : [ | ||
{ | ||
"id": "amsterdam_query", | ||
"params": { "query_string": "amsterdam" }, | ||
"template_id": "match", | ||
"ratings": [] | ||
} | ||
], | ||
"metric" : { "precision": { }} | ||
} |
Oops, something went wrong.