Skip to content

Commit 20604d6

Browse files
committed
Add tests
1 parent 6f8be9c commit 20604d6

File tree

1 file changed

+110
-23
lines changed
  • modules/mapper-extras/src/yamlRestTest/resources/rest-api-spec/test/match_only_text

1 file changed

+110
-23
lines changed

modules/mapper-extras/src/yamlRestTest/resources/rest-api-spec/test/match_only_text/10_basic.yml

Lines changed: 110 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
setup:
22

33
- requires:
4-
cluster_features: ["gte_v7.14.0"]
4+
cluster_features: [ "gte_v7.14.0" ]
55
reason: "match_only_text was added in 7.14"
66

77
- do:
88
indices.create:
9-
index: test
9+
index: test
1010
body:
1111
mappings:
1212
properties:
@@ -16,29 +16,29 @@ setup:
1616
- do:
1717
index:
1818
index: test
19-
id: "1"
20-
body: {}
19+
id: "1"
20+
body: { }
2121

2222
- do:
2323
index:
2424
index: test
25-
id: "2"
26-
body: { "foo": "Apache Lucene powers Elasticsearch" }
25+
id: "2"
26+
body: { "foo": "Apache Lucene powers Elasticsearch" }
2727

2828
- do:
2929
index:
3030
index: test
31-
id: "3"
32-
body: { "foo": "Elasticsearch is based on Apache Lucene" }
31+
id: "3"
32+
body: { "foo": "Elasticsearch is based on Apache Lucene" }
3333

3434
- do:
3535
index:
3636
index: test
37-
id: "4"
38-
body: { "foo": "The Apache Software Foundation manages many projects including Lucene" }
37+
id: "4"
38+
body: { "foo": "The Apache Software Foundation manages many projects including Lucene" }
3939

4040
- do:
41-
indices.refresh: {}
41+
indices.refresh: { }
4242

4343
---
4444
"Field caps":
@@ -257,7 +257,7 @@ setup:
257257
"Wildcard highlighting":
258258

259259
- requires:
260-
cluster_features: ["gte_v8.3.0"]
260+
cluster_features: [ "gte_v8.3.0" ]
261261
reason: "Wildcard highlighting on match_only_text was fixed in 8.3"
262262

263263
- do:
@@ -269,7 +269,7 @@ setup:
269269
foo: "many"
270270
highlight:
271271
fields:
272-
"*": {}
272+
"*": { }
273273

274274
- match: { hits.total.value: 1 }
275275
- match: { hits.hits.0._source.foo: "The Apache Software Foundation manages many projects including Lucene" }
@@ -296,7 +296,7 @@ synthetic_source:
296296
- do:
297297
index:
298298
index: synthetic_source_test
299-
id: "1"
299+
id: "1"
300300
refresh: true
301301
body:
302302
foo: "Apache Lucene powers Elasticsearch"
@@ -312,7 +312,7 @@ synthetic_source:
312312
---
313313
tsdb:
314314
- requires:
315-
cluster_features: ["gte_v8.10.0"]
315+
cluster_features: [ "gte_v8.10.0" ]
316316
reason: bug fixed in 8.10.0
317317

318318
- do:
@@ -349,8 +349,8 @@ tsdb:
349349
- match: { "hits.total.value": 1 }
350350
- match:
351351
hits.hits.0._source:
352-
"@timestamp" : "2000-01-01T00:00:00.000Z"
353-
"dimension" : "a"
352+
"@timestamp": "2000-01-01T00:00:00.000Z"
353+
"dimension": "a"
354354
foo: "Apache Lucene powers Elasticsearch"
355355

356356
---
@@ -377,7 +377,7 @@ synthetic_source with copy_to:
377377
- do:
378378
index:
379379
index: synthetic_source_test
380-
id: "1"
380+
id: "1"
381381
refresh: true
382382
body:
383383
foo: "Apache Lucene powers Elasticsearch"
@@ -386,7 +386,7 @@ synthetic_source with copy_to:
386386
search:
387387
index: synthetic_source_test
388388
body:
389-
fields: ["copy"]
389+
fields: [ "copy" ]
390390

391391
- match: { "hits.total.value": 1 }
392392
- match:
@@ -418,7 +418,51 @@ synthetic_source match_only_text as multi-field:
418418
- do:
419419
index:
420420
index: synthetic_source_test
421-
id: "1"
421+
id: "1"
422+
refresh: true
423+
body:
424+
foo: "Apache Lucene powers Elasticsearch"
425+
426+
- do:
427+
search:
428+
index: synthetic_source_test
429+
body:
430+
query:
431+
match_phrase:
432+
foo.text: apache lucene
433+
434+
- match: { "hits.total.value": 1 }
435+
- match:
436+
hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch"
437+
438+
---
439+
synthetic_source match_only_text as multi-field with ignored keyword as parent:
440+
- requires:
441+
cluster_features: [ "mapper.source.mode_from_index_setting" ]
442+
reason: "Source mode configured through index setting"
443+
444+
- do:
445+
indices.create:
446+
index: synthetic_source_test
447+
body:
448+
settings:
449+
index:
450+
mapping.source.mode: synthetic
451+
mappings:
452+
properties:
453+
foo:
454+
type: keyword
455+
store: false
456+
doc_values: true
457+
ignore_above: 10
458+
fields:
459+
text:
460+
type: match_only_text
461+
462+
- do:
463+
index:
464+
index: synthetic_source_test
465+
id: "1"
422466
refresh: true
423467
body:
424468
foo: "Apache Lucene powers Elasticsearch"
@@ -461,7 +505,7 @@ synthetic_source match_only_text as multi-field with stored keyword as parent:
461505
- do:
462506
index:
463507
index: synthetic_source_test
464-
id: "1"
508+
id: "1"
465509
refresh: true
466510
body:
467511
foo: "Apache Lucene powers Elasticsearch"
@@ -545,7 +589,50 @@ synthetic_source match_only_text with multi-field:
545589
- do:
546590
index:
547591
index: synthetic_source_test
548-
id: "1"
592+
id: "1"
593+
refresh: true
594+
body:
595+
foo: "Apache Lucene powers Elasticsearch"
596+
597+
- do:
598+
search:
599+
index: synthetic_source_test
600+
body:
601+
query:
602+
match_phrase:
603+
foo: apache lucene
604+
605+
- match: { "hits.total.value": 1 }
606+
- match:
607+
hits.hits.0._source.foo: "Apache Lucene powers Elasticsearch"
608+
609+
---
610+
synthetic_source match_only_text with ignored multi-field:
611+
- requires:
612+
cluster_features: [ "mapper.source.mode_from_index_setting" ]
613+
reason: "Source mode configured through index setting"
614+
615+
- do:
616+
indices.create:
617+
index: synthetic_source_test
618+
body:
619+
settings:
620+
index:
621+
mapping.source.mode: synthetic
622+
mappings:
623+
properties:
624+
foo:
625+
type: match_only_text
626+
fields:
627+
raw:
628+
type: keyword
629+
store: false
630+
doc_values: true
631+
632+
- do:
633+
index:
634+
index: synthetic_source_test
635+
id: "1"
549636
refresh: true
550637
body:
551638
foo: "Apache Lucene powers Elasticsearch"
@@ -588,7 +675,7 @@ synthetic_source match_only_text with stored multi-field:
588675
- do:
589676
index:
590677
index: synthetic_source_test
591-
id: "1"
678+
id: "1"
592679
refresh: true
593680
body:
594681
foo: "Apache Lucene powers Elasticsearch"

0 commit comments

Comments
 (0)