Skip to content

Commit

Permalink
Added tests for GET and POST /{index}/_explain/{id}.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Nov 20, 2024
1 parent da003f3 commit fc1d90d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/schemas/_core.explain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ components:
items:
$ref: '#/components/schemas/ExplanationDetail'
value:
oneOf:
anyOf:
- type: integer
format: int32
- type: integer
Expand Down
51 changes: 51 additions & 0 deletions tests/default/indices/explain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test getting an explanation of how the relevance score is calculated for every result.
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: Bennett Miller, title: The Cruise, year: 1998}
- {create: {_index: movies, _id: movie2}}
- {director: Nicolas Winding Refn, title: Drive, year: 1960}
chapters:
- synopsis: Explain the score for a match query (GET).
path: /{index}/_explain/{id}
method: GET
parameters:
index: movies
id: movie1
request:
payload:
query:
match:
year: 1998
response:
status: 200
- synopsis: Explain the score for a match query (POST).
path: /{index}/_explain/{id}
method: POST
parameters:
index: movies
id: movie2
preference: _local
routing: primary
_source: true
_source_excludes: title
_source_includes: director
request:
payload:
query:
match:
title: Drive
response:
status: 200

0 comments on commit fc1d90d

Please sign in to comment.