Skip to content

Commit

Permalink
Fix failure in fvh REST tests. (#66192)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jtibshirani committed Dec 15, 2020
1 parent c318e14 commit 9fa80c1
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
setup:
- skip:
version: "all"
reason: "AwaitsFix https://github.com/elastic/elasticsearch/issues/66147"
- do:
indices.create:
index: test
Expand All @@ -27,25 +24,30 @@ 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":
- do:
search:
rest_total_hits_as_int: true
body:
query:
term:
id: 1
highlight:
type: fvh
fields:
Expand Down Expand Up @@ -80,6 +82,7 @@ setup:
fields:
title:
type: fvh
sort: [id]

- match: {hits.hits.0.highlight.title.0: "The quick brown <em>fox</em> is brown"}
- is_false: hits.hits.0.highlight.description
Expand Down

0 comments on commit 9fa80c1

Please sign in to comment.