Skip to content

Commit

Permalink
Added tests for basic _search.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jun 21, 2024
1 parent 33aa91a commit fd1f31c
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Kuromoji
Lovins
Lucene
Millis
Moneyball
Multisearch
Nanos
Nori
Expand Down
89 changes: 89 additions & 0 deletions tests/_core/search.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
$schema: ../../json_schemas/test_story.schema.yaml

skip: false
description: Test search endpoint.
prologues:
- path: /movies/_doc?refresh=true
method: POST
request_body:
payload:
director: Bennett Miller
title: Moneyball
year: 2011
response:
status: 201
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Search with size=0.
path: /{index}/_search
parameters:
index: movies
method: POST
request_body:
payload:
size: 0
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 1
relation: eq
max_score: null
hits: []
- synopsis: Search with size=1.
path: /{index}/_search
parameters:
index: movies
method: POST
request_body:
payload:
size: 1
query:
match_all: {}
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 1
relation: eq
max_score: 1
hits:
- _index: movies
_score: 1
_source:
director: Bennett Miller
title: Moneyball
year: 2011
- synopsis: Search with multi_match query.
path: /{index}/_search
parameters:
index: movies
method: POST
request_body:
payload:
size: 1
query:
multi_match:
query: miller
fields: ["title^2", "director"]
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 1
relation: eq
hits:
- _index: movies
_source:
director: Bennett Miller
title: Moneyball
year: 2011

0 comments on commit fd1f31c

Please sign in to comment.