Selaa lähdekoodia

[TEST] refactor search yaml tests (#19109)

Honza Král 9 vuotta sitten
vanhempi
commit
0ec07833a8

+ 27 - 6
rest-api-spec/src/main/resources/rest-api-spec/test/search/10_source_filtering.yaml

@@ -1,6 +1,5 @@
 ---
-"Source filtering":
-
+setup:
   - do:
       index:
         index:  test_1
@@ -10,40 +9,54 @@
   - do:
       indices.refresh: {}
 
+---
+"_source: true":
 
   - do:
       search:
-      # stringified for boolean value
         body: { _source: true, query: { match_all: {} } }
 
   - length:   { hits.hits: 1  }
   - match: { hits.hits.0._source.count: 1 }
 
+---
+"_source: false":
   - do: { search: { body: { _source: false, query: { match_all: {} } } } }
   - length:   { hits.hits: 1  }
   - is_false: hits.hits.0._source
 
+---
+"no filtering":
   - do: { search: { body: { query: { match_all: {} } } } }
   - length:   { hits.hits: 1  }
   - match: { hits.hits.0._source.count: 1 }
 
+---
+"_source in body":
   - do: { search: { body: { _source: include.field1, query: { match_all: {} } } } }
   - match:  { hits.hits.0._source.include.field1: v1 }
   - is_false: hits.hits.0._source.include.field2
 
+---
+"_source include and _source in body":
   - do: { search: { _source_include: include.field1, body: { _source: include.field2, query: { match_all: {} } } } }
   - match:  { hits.hits.0._source.include.field1: v1 }
   - is_false: hits.hits.0._source.include.field2
 
+---
+"_source_include":
   - do: { search: { _source_include: include.field1, body: { query: { match_all: {} } } } }
   - match:  { hits.hits.0._source.include.field1: v1 }
   - is_false: hits.hits.0._source.include.field2
 
+---
+"_source_exclude":
   - do: { search: { _source_exclude: count, body: { query: { match_all: {} } } } }
   - match:  { hits.hits.0._source.include: { field1 : v1 , field2: v2 }}
   - is_false: hits.hits.0._source.count
 
-
+---
+"_source field1 field2":
   - do:
       search:
         body:
@@ -53,6 +66,8 @@
   - match:  { hits.hits.0._source.include.field2: v2 }
   - is_false: hits.hits.0._source.count
 
+---
+"_source.include field1 field2":
   - do:
       search:
         body:
@@ -63,6 +78,8 @@
   - match:  { hits.hits.0._source.include.field2: v2 }
   - is_false: hits.hits.0._source.count
 
+---
+"_source includes and excludes":
   - do:
       search:
         body:
@@ -73,7 +90,8 @@
   - match:  { hits.hits.0._source.include.field1: v1 }
   - is_false:  hits.hits.0._source.include.field2
 
-
+---
+"fields in body":
   - do:
       search:
         body:
@@ -81,6 +99,8 @@
           query: { match_all: {} }
   - is_false:  hits.hits.0._source
 
+---
+"fields in body with source":
   - do:
         search:
           body:
@@ -89,7 +109,8 @@
   - match: { hits.hits.0._source.include.field2: v2 }
   - is_true:  hits.hits.0._source
 
-
+---
+"fielddata_fields":
   - do:
       search:
         fielddata_fields: [ "count" ]