diff --git a/.cspell b/.cspell index 80670e9b..080c3937 100644 --- a/.cspell +++ b/.cspell @@ -183,4 +183,5 @@ urldecode vectory whoamiprotected wordnet -Yrtsd \ No newline at end of file +Yrtsd +Refn diff --git a/tests/_core/search/rest_total_hits_as_int.yaml b/tests/_core/search/rest_total_hits_as_int.yaml new file mode 100644 index 00000000..1885bc28 --- /dev/null +++ b/tests/_core/search/rest_total_hits_as_int.yaml @@ -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 +