From 9fa80c189607c42bf7ee15e6a0395a5ba76127cd Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 15 Dec 2020 11:28:51 -0800 Subject: [PATCH] Fix failure in fvh REST tests. (#66192) In general, we can't guarantee that a match_all query will return documents in the order they were indexed. This PR adds an ID to each document to avoid relying on document order. --- .../test/search.highlight/20_fvh.yml | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.highlight/20_fvh.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.highlight/20_fvh.yml index 863ebe47555..05c622fc79d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.highlight/20_fvh.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.highlight/20_fvh.yml @@ -1,7 +1,4 @@ setup: - - skip: - version: "all" - reason: "AwaitsFix https://github.com/elastic/elasticsearch/issues/66147" - do: indices.create: index: test @@ -27,18 +24,20 @@ setup: index: test refresh: true body: - "title" : "The quick brown fox is brown" - "description" : "The quick pink panther is pink" + id : 1 + title : "The quick brown fox is brown" + description : "The quick pink panther is pink" - do: index: index: test refresh: true body: - "title" : "The quick blue fox is blue" - "nested": - - "title": "purple octopus" - - "title": "purple fish" + id : 2 + title : "The quick blue fox is blue" + nested: + - title: "purple octopus" + - title: "purple fish" --- "Highlight query": @@ -46,6 +45,9 @@ setup: search: rest_total_hits_as_int: true body: + query: + term: + id: 1 highlight: type: fvh fields: @@ -80,6 +82,7 @@ setup: fields: title: type: fvh + sort: [id] - match: {hits.hits.0.highlight.title.0: "The quick brown fox is brown"} - is_false: hits.hits.0.highlight.description