diff --git a/spec/schemas/_core.rank_eval.yaml b/spec/schemas/_core.rank_eval.yaml index 872689551..3d687205c 100644 --- a/spec/schemas/_core.rank_eval.yaml +++ b/spec/schemas/_core.rank_eval.yaml @@ -134,7 +134,7 @@ components: additionalProperties: type: object additionalProperties: - type: object + type: number required: - hits - metric_details diff --git a/tests/default/indices/rank_eval.yaml b/tests/default/indices/rank_eval.yaml new file mode 100644 index 000000000..110fba2f7 --- /dev/null +++ b/tests/default/indices/rank_eval.yaml @@ -0,0 +1,66 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test rank evaluation API using both GET and POST methods. +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +prologues: + - path: /_bulk + method: POST + parameters: + refresh: true + request: + content_type: application/x-ndjson + payload: + - {create: {_index: movies, _id: movie1}} + - {director: Quentin Tarantino, title: Pulp Fiction, year: 1994} + - {create: {_index: movies, _id: movie2}} + - {director: Christopher Nolan, title: Inception, year: 2010} + +chapters: + - synopsis: Perform rank evaluation using GET. + path: /{index}/_rank_eval + method: GET + parameters: + index: movies + request: + payload: + metric: + precision: + k: 10 + requests: + - id: "query_1" + request: + query: + match: + title: "Pulp Fiction" + ratings: + - _id: "movie1" + rating: 1 + _index: movies + response: + status: 200 + + - synopsis: Perform rank evaluation using POST. + path: /{index}/_rank_eval + method: POST + parameters: + index: [movies] + request: + payload: + metric: + mean_reciprocal_rank: + k: 10 + requests: + - id: "query_2" + request: + query: + match: + director: "Christopher Nolan" + ratings: + - _id: "movie2" + _index: movies + rating: 1 + response: + status: 200