-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixup highlighting with synthetic source #87667
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
314 changes: 314 additions & 0 deletions
314
...ec/src/yamlRestTest/resources/rest-api-spec/test/search.highlight/50_synthetic_source.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,314 @@ | ||
setup: | ||
- skip: | ||
version: " - 8.3.99" | ||
reason: introduced in 8.4.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
mappings: | ||
_source: | ||
synthetic: true | ||
properties: | ||
foo: | ||
type: keyword | ||
fields: | ||
analyze: | ||
type: text | ||
index_options: positions | ||
vectors: | ||
type: text | ||
term_vector: with_positions_offsets | ||
positions: | ||
type: text | ||
index_options: offsets | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
refresh: true | ||
body: | ||
foo: the quick brown fox jumped over the lazy dog | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 2 | ||
refresh: true | ||
body: | ||
foo: | ||
- "To be, or not to be, that is the question:" | ||
- "Whether 'tis nobler in the mind to suffer" | ||
- "The slings and arrows of outrageous fortune," | ||
- "Or to take arms against a sea of troubles" | ||
- "And by opposing end them. To die—to sleep," | ||
- "No more; and by a sleep to say we end" | ||
- "The heart-ache and the thousand natural shocks" | ||
- "That flesh is heir to: 'tis a consummation" | ||
- "Devoutly to be wish'd. To die, to sleep;" | ||
- "To sleep, perchance to dream—ay, there's the rub:" | ||
- "For in that sleep of death what dreams may come," | ||
- "When we have shuffled off this mortal coil," | ||
- "Must give us pause—there's the respect" | ||
- "That makes calamity of so long life." | ||
- "For who would bear the whips and scorns of time," | ||
- "Th'oppressor's wrong, the proud man's contumely," | ||
- "The pangs of dispriz'd love, the law's delay," | ||
- "The insolence of office, and the spurns" | ||
- "That patient merit of th'unworthy takes," | ||
- "When he himself might his quietus make" | ||
- "With a bare bodkin? Who would fardels bear," | ||
- "To grunt and sweat under a weary life," | ||
- "But that the dread of something after death," | ||
- "The undiscovere'd country, from whose bourn" | ||
- "No traveller returns, puzzles the will," | ||
- "And makes us rather bear those ills we have" | ||
- "Than fly to others that we know not of?" | ||
- "Thus conscience doth make cowards of us all," | ||
- "And thus the native hue of resolution" | ||
- "Is sicklied o'er with the pale cast of thought," | ||
- "And enterprises of great pith and moment" | ||
- "With this regard their currents turn awry" | ||
- "And lose the name of action." | ||
|
||
--- | ||
keyword single plain: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo: | ||
type: plain | ||
- match: { hits.hits.0.highlight.foo.0: <em>the quick brown fox jumped over the lazy dog</em> } | ||
|
||
--- | ||
keyword multi plain: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo: | ||
type: plain | ||
- match: { hits.hits.0.highlight.foo.0: <em>That makes calamity of so long life.</em> } | ||
|
||
--- | ||
keyword single unified: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo.0: <em>the quick brown fox jumped over the lazy dog</em> } | ||
|
||
--- | ||
keyword multi unified: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo.0: <em>That makes calamity of so long life.</em> } | ||
|
||
--- | ||
keyword single fvh: | ||
- do: | ||
catch: /the field \[foo\] should be indexed with term vector with position offsets to be used with fast vector highlighter/ | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo: | ||
type: fvh | ||
|
||
--- | ||
keyword multi fvh: | ||
- do: | ||
catch: /the field \[foo\] should be indexed with term vector with position offsets to be used with fast vector highlighter/ | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo: | ||
type: fvh | ||
|
||
--- | ||
text single plain: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.analyze: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo.analyze: | ||
type: plain | ||
- match: { hits.hits.0.highlight.foo\.analyze.0: <em>the</em> <em>quick</em> <em>brown</em> <em>fox</em> <em>jumped</em> <em>over</em> <em>the</em> <em>lazy</em> <em>dog</em> } | ||
|
||
--- | ||
text multi plain: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.analyze: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo.analyze: | ||
type: plain | ||
- match: { hits.hits.0.highlight.foo\.analyze.0: <em>That</em> <em>makes</em> <em>calamity</em> <em>of</em> <em>so</em> <em>long</em> <em>life</em>. } | ||
|
||
--- | ||
text single unified from reanalysis: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.analyze: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo.analyze: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo\.analyze.0: <em>the</em> <em>quick</em> <em>brown</em> <em>fox</em> <em>jumped</em> <em>over</em> <em>the</em> <em>lazy</em> <em>dog</em> } | ||
|
||
--- | ||
text multi unified from reanalysis: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.analyze: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo.analyze: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo\.analyze.0: <em>That</em> <em>makes</em> <em>calamity</em> <em>of</em> <em>so</em> <em>long</em> <em>life</em>. } | ||
|
||
--- | ||
text single unified from positions: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.positions: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo.positions: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo\.positions.0: <em>the</em> <em>quick</em> <em>brown</em> <em>fox</em> <em>jumped</em> <em>over</em> <em>the</em> <em>lazy</em> <em>dog</em> } | ||
|
||
--- | ||
text multi unified from positions: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.positions: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo.positions: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo\.positions.0: <em>That</em> <em>makes</em> <em>calamity</em> <em>of</em> <em>so</em> <em>long</em> <em>life</em>. } | ||
|
||
--- | ||
text single unified from vectors: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.vectors: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo.vectors: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo\.vectors.0: <em>the</em> <em>quick</em> <em>brown</em> <em>fox</em> <em>jumped</em> <em>over</em> <em>the</em> <em>lazy</em> <em>dog</em> } | ||
|
||
--- | ||
text multi unified from vectors: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.vectors: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo.vectors: | ||
type: unified | ||
- match: { hits.hits.0.highlight.foo\.vectors.0: <em>That</em> <em>makes</em> <em>calamity</em> <em>of</em> <em>so</em> <em>long</em> <em>life</em>. } | ||
|
||
--- | ||
text single fvh: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.vectors: "the quick brown fox jumped over the lazy dog" | ||
highlight: | ||
fields: | ||
foo.vectors: | ||
type: fvh | ||
- match: { hits.hits.0.highlight.foo\.vectors.0: <em>the quick brown fox jumped over the lazy dog</em> } | ||
|
||
--- | ||
text multi fvh: | ||
- do: | ||
catch: /The fast vector highlighter doesn't support loading multi-valued fields from _source in index \[test\] because _source can reorder field values/ | ||
search: | ||
index: test | ||
body: | ||
query: | ||
match_phrase: | ||
foo.vectors: "That makes calamity of so long life." | ||
highlight: | ||
fields: | ||
foo.vectors: | ||
type: fvh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test that this also occurs when you ask for fragments in order, so that we exercise both FragmentsBuilder implementations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍