Skip to content

Commit 9ee0abc

Browse files
committed
Added test for significant_text on annotated_text field.
1 parent dd5bcd4 commit 9ee0abc

File tree

1 file changed

+40
-0
lines changed
  • plugins/mapper-annotated-text/src/yamlRestTest/resources/rest-api-spec/test/mapper_annotatedtext

1 file changed

+40
-0
lines changed

plugins/mapper-annotated-text/src/yamlRestTest/resources/rest-api-spec/test/mapper_annotatedtext/10_basic.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,43 @@
143143
body: { "query" : {"match_phrase" : { "my_field" : {"query": "~MARK0", "analyzer": "whitespace"} } }, "highlight" : { "type" : "annotated", "fields" : { "my_field" : {} } } }
144144
- match: {_shards.failed: 0}
145145

146+
---
147+
"Signficant text support":
148+
- do:
149+
indices.create:
150+
index: annotated
151+
body:
152+
settings:
153+
number_of_shards: "1"
154+
number_of_replicas: "0"
155+
mappings:
156+
properties:
157+
my_field:
158+
type: annotated_text
159+
160+
- do:
161+
index:
162+
index: annotated
163+
id: 1
164+
body:
165+
"my_field" : "[Apple](Apple+Inc) launched the iphone 12"
166+
- do:
167+
index:
168+
index: annotated
169+
id: 2
170+
body:
171+
"my_field" : "[They](Apple+Inc) make iphone accessories"
172+
- do:
173+
index:
174+
index: annotated
175+
id: 3
176+
body:
177+
"my_field" : "[Apple](Apple+Inc) have a new iphone coming"
178+
refresh: true
179+
- do:
180+
search:
181+
request_cache: false
182+
body: { "query" : {"match" : { "my_field" : "iphone" } }, "aggs" : { "keywords" : { "significant_text" : {"field" : "my_field", "min_doc_count":3, "percentage":{}, "exclude":["iphone"]} } } }
183+
- match: {_shards.failed: 0}
184+
- match: {aggregations.keywords.buckets.0.key: "Apple Inc"}
185+

0 commit comments

Comments
 (0)