|
@@ -288,3 +288,150 @@ setup:
|
|
|
- length: { hits.hits.0.highlight.semantic_text_field: 2 }
|
|
|
- match: { hits.hits.0.highlight.semantic_text_field.0: "some test data" }
|
|
|
- match: { hits.hits.0.highlight.semantic_text_field.1: "now with chunks" }
|
|
|
+
|
|
|
+---
|
|
|
+"Highlighting with match_all query":
|
|
|
+ - requires:
|
|
|
+ cluster_features: "semantic_text.match_all_highlighter"
|
|
|
+ reason: semantic text field supports match_all query with semantic highlighter, effective from 8.19 and 9.1.0.
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: test-sparse-index
|
|
|
+ id: doc_1
|
|
|
+ body:
|
|
|
+ body: [ "ElasticSearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides.", "You Know, for Search!" ]
|
|
|
+ refresh: true
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: test-sparse-index
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ match_all: {}
|
|
|
+ highlight:
|
|
|
+ fields:
|
|
|
+ body:
|
|
|
+ type: "semantic"
|
|
|
+ number_of_fragments: 2
|
|
|
+
|
|
|
+ - match: { hits.total.value: 1 }
|
|
|
+ - match: { hits.hits.0._id: "doc_1" }
|
|
|
+ - length: { hits.hits.0.highlight.body: 2 }
|
|
|
+ - match: { hits.hits.0.highlight.body.0: "ElasticSearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides." }
|
|
|
+ - match: { hits.hits.0.highlight.body.1: "You Know, for Search!" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: test-dense-index
|
|
|
+ id: doc_1
|
|
|
+ body:
|
|
|
+ body: [ "ElasticSearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides.", "You Know, for Search!" ]
|
|
|
+ refresh: true
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: test-dense-index
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ match_all: {}
|
|
|
+ highlight:
|
|
|
+ fields:
|
|
|
+ body:
|
|
|
+ type: "semantic"
|
|
|
+ number_of_fragments: 2
|
|
|
+
|
|
|
+ - match: { hits.total.value: 1 }
|
|
|
+ - match: { hits.hits.0._id: "doc_1" }
|
|
|
+ - length: { hits.hits.0.highlight.body: 2 }
|
|
|
+ - match: { hits.hits.0.highlight.body.0: "ElasticSearch is an open source, distributed, RESTful, search engine which is built on top of Lucene internally and enjoys all the features it provides." }
|
|
|
+ - match: { hits.hits.0.highlight.body.1: "You Know, for Search!" }
|
|
|
+
|
|
|
+---
|
|
|
+"Highlighting with match_all and multi chunks with empty input":
|
|
|
+ - requires:
|
|
|
+ cluster_features: "semantic_text.match_all_highlighter"
|
|
|
+ reason: semantic text field supports match_all query with semantic highlighter, effective from 8.19 and 9.1.0.
|
|
|
+
|
|
|
+ - do:
|
|
|
+ indices.create:
|
|
|
+ index: test-index-sparse
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.mapping.semantic_text.use_legacy_format: true
|
|
|
+ mappings:
|
|
|
+ properties:
|
|
|
+ semantic_text_field:
|
|
|
+ type: semantic_text
|
|
|
+ inference_id: sparse-inference-id
|
|
|
+ text_field:
|
|
|
+ type: text
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: test-index-sparse
|
|
|
+ id: doc_1
|
|
|
+ body:
|
|
|
+ semantic_text_field: [ "some test data", " ", "now with chunks" ]
|
|
|
+ text_field: "some test data"
|
|
|
+ refresh: true
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: test-index-sparse
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ match_all: {}
|
|
|
+ highlight:
|
|
|
+ fields:
|
|
|
+ semantic_text_field:
|
|
|
+ type: "semantic"
|
|
|
+ number_of_fragments: 2
|
|
|
+
|
|
|
+ - match: { hits.total.value: 1 }
|
|
|
+ - match: { hits.hits.0._id: "doc_1" }
|
|
|
+ - length: { hits.hits.0.highlight.semantic_text_field: 2 }
|
|
|
+ - match: { hits.hits.0.highlight.semantic_text_field.0: "some test data" }
|
|
|
+ - match: { hits.hits.0.highlight.semantic_text_field.1: "now with chunks" }
|
|
|
+
|
|
|
+ - do:
|
|
|
+ indices.create:
|
|
|
+ index: test-index-dense
|
|
|
+ body:
|
|
|
+ settings:
|
|
|
+ index.mapping.semantic_text.use_legacy_format: true
|
|
|
+ mappings:
|
|
|
+ properties:
|
|
|
+ semantic_text_field:
|
|
|
+ type: semantic_text
|
|
|
+ inference_id: dense-inference-id
|
|
|
+ text_field:
|
|
|
+ type: text
|
|
|
+
|
|
|
+ - do:
|
|
|
+ index:
|
|
|
+ index: test-index-dense
|
|
|
+ id: doc_1
|
|
|
+ body:
|
|
|
+ semantic_text_field: [ "some test data", " ", "now with chunks" ]
|
|
|
+ text_field: "some test data"
|
|
|
+ refresh: true
|
|
|
+
|
|
|
+ - do:
|
|
|
+ search:
|
|
|
+ index: test-index-dense
|
|
|
+ body:
|
|
|
+ query:
|
|
|
+ match_all: {}
|
|
|
+ highlight:
|
|
|
+ fields:
|
|
|
+ semantic_text_field:
|
|
|
+ type: "semantic"
|
|
|
+ number_of_fragments: 2
|
|
|
+
|
|
|
+ - match: { hits.total.value: 1 }
|
|
|
+ - match: { hits.hits.0._id: "doc_1" }
|
|
|
+ - length: { hits.hits.0.highlight.semantic_text_field: 2 }
|
|
|
+ - match: { hits.hits.0.highlight.semantic_text_field.0: "some test data" }
|
|
|
+ - match: { hits.hits.0.highlight.semantic_text_field.1: "now with chunks" }
|
|
|
+
|