Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] Move templated _rank_eval tests #30679

Merged
merged 1 commit into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions qa/smoke-test-rank-eval-with-mustache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@ dependencies {
* and will be fixed later.
* Tracked by https://github.com/elastic/elasticsearch/issues/30628
*/
if ("zip".equals(integTestCluster.distribution)) {
integTestRunner.enabled = false
}

This file was deleted.

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": { }}
}
Loading