Skip to content

Commit

Permalink
Added rest_total_hits_as_int test for _search (#466)
Browse files Browse the repository at this point in the history
* Added rest_total_hits_as_int test for _search

Signed-off-by: Andy Wick <[email protected]>

* change request_body to request

Signed-off-by: Andy Wick <[email protected]>

* Not gonna fight the linter

Signed-off-by: Andy Wick <[email protected]>

* Add "Refn" to .cspell and back to test

Signed-off-by: Andy Wick <[email protected]>

---------

Signed-off-by: Andy Wick <[email protected]>
  • Loading branch information
awick committed Aug 5, 2024
1 parent 1061972 commit c0d4a85
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .cspell
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,5 @@ urldecode
vectory
whoamiprotected
wordnet
Yrtsd
Yrtsd
Refn
125 changes: 125 additions & 0 deletions tests/_core/search/rest_total_hits_as_int.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test search endpoint with rest_total_hits_as_int.
prologues:
- path: /movies/_doc
method: POST
parameters:
refresh: true
request:
payload:
director: Bennett Miller
title: Moneyball
year: 2011
status: [201]
- path: /movies/_doc
method: POST
parameters:
refresh: true
request:
payload:
director: Nicolas Winding Refn
title: Drive
year: 2011
status: [201]
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Search with rest_total_hits_as_int=true.
path: /{index}/_search
parameters:
index: movies
rest_total_hits_as_int: true
method: POST
request:
payload:
query:
match_all: {}
response:
status: 200
payload:
timed_out: false
hits:
total: 2
max_score: 1
hits:
- _index: movies
_score: 1
_source:
director: Bennett Miller
title: Moneyball
year: 2011
- _index: movies
_score: 1
_source:
director: Nicolas Winding Refn
title: Drive
year: 2011
- synopsis: Search with rest_total_hits_as_int=false.
path: /{index}/_search
parameters:
index: movies
rest_total_hits_as_int: false
method: POST
request:
payload:
query:
match_all: {}
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 2
relation: eq
max_score: 1
hits:
- _index: movies
_score: 1
_source:
director: Bennett Miller
title: Moneyball
year: 2011
- _index: movies
_score: 1
_source:
director: Nicolas Winding Refn
title: Drive
year: 2011
- synopsis: Search with rest_total_hits_as_int=false track_total_hits=1.
path: /{index}/_search
parameters:
index: movies
rest_total_hits_as_int: false
method: POST
request:
payload:
track_total_hits: 1
query:
match_all: {}
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 1
relation: gte
max_score: 1
hits:
- _index: movies
_score: 1
_source:
director: Bennett Miller
title: Moneyball
year: 2011
- _index: movies
_score: 1
_source:
director: Nicolas Winding Refn
title: Drive
year: 2011

0 comments on commit c0d4a85

Please sign in to comment.