summaryrefslogtreecommitdiff
path: root/rest-api-spec
diff options
context:
space:
mode:
authorJim Ferenczi <jim.ferenczi@elastic.co>2017-06-15 00:33:01 +0200
committerGitHub <noreply@github.com>2017-06-15 00:33:01 +0200
commit68deda6d0300eebbf5a3b3ee0db5593efbee6bfe (patch)
treef7580c5135549f3e3e450a1592bd0b17ef5c89fd /rest-api-spec
parent4a30e23365e3da296b3e54223b7dded280b532bd (diff)
FastVectorHighlighter should not cache the field query globally (#25197)
This commit removes the global caching of the field query and replaces it with a caching per field. Each field can use a different `highlight_query` and the rewriting of some queries (prefix, automaton, ...) depends on the targeted field so the query used for highlighting must be unique per field. There might be a small performance penalty when highlighting multiple fields since the query needs to be rewritten once per highlighted field with this change. Fixes #25171
Diffstat (limited to 'rest-api-spec')
-rw-r--r--rest-api-spec/src/main/resources/rest-api-spec/test/search.highlight/20_fvh.yml49
1 files changed, 49 insertions, 0 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
new file mode 100644
index 0000000000..d4cb980a05
--- /dev/null
+++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.highlight/20_fvh.yml
@@ -0,0 +1,49 @@
+setup:
+ - do:
+ indices.create:
+ index: test
+ body:
+ mappings:
+ doc:
+ "properties":
+ "title":
+ "type": "text"
+ "term_vector": "with_positions_offsets"
+ "description":
+ "type": "text"
+ "term_vector": "with_positions_offsets"
+ - do:
+ index:
+ index: test
+ type: doc
+ id: 1
+ body:
+ "title" : "The quick brown fox is brown"
+ "description" : "The quick pink panther is pink"
+ - do:
+ indices.refresh: {}
+
+---
+"Highlight query":
+ - skip:
+ version: " - 5.5.99"
+ reason: bug fixed in 5.6
+ - do:
+ search:
+ body:
+ highlight:
+ type: fvh
+ fields:
+ description:
+ type: fvh
+ highlight_query:
+ prefix:
+ description: br
+ title:
+ type: fvh
+ highlight_query:
+ prefix:
+ title: br
+
+ - match: {hits.hits.0.highlight.title.0: "The quick <em>brown</em> fox is <em>brown</em>"}
+ - is_false: hits.hits.0.highlight.description