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.
This commit is contained in:
Julie Tibshirani 2020-12-15 11:28:51 -08:00
parent c318e14fed
commit 9fa80c1896
1 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,4 @@
setup: setup:
- skip:
version: "all"
reason: "AwaitsFix https://github.com/elastic/elasticsearch/issues/66147"
- do: - do:
indices.create: indices.create:
index: test index: test
@ -27,18 +24,20 @@ setup:
index: test index: test
refresh: true refresh: true
body: body:
"title" : "The quick brown fox is brown" id : 1
"description" : "The quick pink panther is pink" title : "The quick brown fox is brown"
description : "The quick pink panther is pink"
- do: - do:
index: index:
index: test index: test
refresh: true refresh: true
body: body:
"title" : "The quick blue fox is blue" id : 2
"nested": title : "The quick blue fox is blue"
- "title": "purple octopus" nested:
- "title": "purple fish" - title: "purple octopus"
- title: "purple fish"
--- ---
"Highlight query": "Highlight query":
@ -46,6 +45,9 @@ setup:
search: search:
rest_total_hits_as_int: true rest_total_hits_as_int: true
body: body:
query:
term:
id: 1
highlight: highlight:
type: fvh type: fvh
fields: fields:
@ -80,6 +82,7 @@ setup:
fields: fields:
title: title:
type: fvh type: fvh
sort: [id]
- match: {hits.hits.0.highlight.title.0: "The quick brown <em>fox</em> is brown"} - match: {hits.hits.0.highlight.title.0: "The quick brown <em>fox</em> is brown"}
- is_false: hits.hits.0.highlight.description - is_false: hits.hits.0.highlight.description