From 2df03620714371bf3611183ed8b6542890b60e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Thu, 11 Feb 2021 18:38:39 +0100 Subject: [PATCH] Add additional fields API tests (#68897) This change adds tests around the handling of mixed object and dot notation in document source when using the `fields` API with nested fields left out of #67432. After merging #68540, this test can now be added. Relates to #67432 --- .../test/search/330_fetch_fields.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search/330_fetch_fields.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search/330_fetch_fields.yml index 4311ee0fcd321..cae8834b2521e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search/330_fetch_fields.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search/330_fetch_fields.yml @@ -519,6 +519,9 @@ Test nested field inside object structure: id: 2 refresh: true body: + obj: + products: + - { "manufacturer" : "MaxEngine", "base_price" : 11.0, "product_id" : 67890} obj.products: - { "manufacturer" : "RealTec", "base_price" : 12.55, "product_id" : 23451} obj.other_obj_field: other_value2 @@ -538,7 +541,9 @@ Test nested field inside object structure: - match: hits.hits.0.fields.obj\.other_obj_field.0: other_value - match: - hits.hits.1.fields.obj\.products.0: { "manufacturer" : ["RealTec"], "base_price" : [12.55], "product_id" : [23451]} + hits.hits.1.fields.obj\.products.0: { "manufacturer" : ["MaxEngine"], "base_price" : [11.0], "product_id" : [67890]} + - match: + hits.hits.1.fields.obj\.products.1: { "manufacturer" : ["RealTec"], "base_price" : [12.55], "product_id" : [23451]} - match: hits.hits.1.fields.obj\.other_obj_field.0: other_value2 @@ -562,7 +567,9 @@ Test nested field inside object structure: - match: hits.hits.0.fields.obj\.products.1: { "manufacturer" : ["HyperSmart"]} - match: - hits.hits.1.fields.obj\.products.0: { "manufacturer" : ["RealTec"]} + hits.hits.1.fields.obj\.products.0: { "manufacturer" : ["MaxEngine"]} + - match: + hits.hits.1.fields.obj\.products.1: { "manufacturer" : ["RealTec"]} - do: search: @@ -575,7 +582,9 @@ Test nested field inside object structure: - match: hits.hits.0.fields.obj\.products.1: { "manufacturer" : ["HyperSmart"]} - match: - hits.hits.1.fields.obj\.products.0: { "manufacturer" : ["RealTec"]} + hits.hits.1.fields.obj\.products.0: { "manufacturer" : ["MaxEngine"]} + - match: + hits.hits.1.fields.obj\.products.1: { "manufacturer" : ["RealTec"]} --- Test doubly nested fields: - skip: