Skip to content

Commit

Permalink
Add additional fields API tests (#68897)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Christoph Büscher committed Feb 11, 2021
1 parent c6a6bc3 commit 2df0362
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 2df0362

Please sign in to comment.