Skip to content

Commit 227d809

Browse files
authored
Add tests for query/agg on lookup runtime fields (elastic#88389)
Adds tests to ensure that querying and aggregating on lookup runtimes aren't supported. Relates elastic#88296
1 parent d6b38f6 commit 227d809

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/search/390_lookup_fields.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,41 @@ setup:
4949
- match: { hits.hits.0.fields.location: [ { country: [ 'Canada' ], city: [ 'Montreal' ] } ] }
5050
- match: { hits.hits.1.fields.msg: [ 'The second message' ] }
5151
- match: { hits.hits.1.fields.location: null }
52+
53+
---
54+
"Fails to query or aggregate on lookup fields":
55+
- skip:
56+
version: " - 8.1.99"
57+
reason: "Lookup fields are introduced in 8.2"
58+
- do:
59+
catch: /Field \[location\] of type \[lookup\] does not support match queries/
60+
search:
61+
index: logs
62+
body:
63+
runtime_mappings:
64+
location:
65+
type: lookup
66+
target_index: ip_locations
67+
input_field: ip
68+
target_field: _id
69+
fetch_fields: [ "city"]
70+
query:
71+
match:
72+
location: montreal
73+
74+
- do:
75+
catch: /Fielddata is not supported on field \[location\] of type \[lookup\]/
76+
search:
77+
index: logs
78+
body:
79+
runtime_mappings:
80+
location:
81+
type: lookup
82+
target_index: ip_locations
83+
input_field: ip
84+
target_field: _id
85+
fetch_fields: [ "city" ]
86+
aggs:
87+
locations:
88+
terms:
89+
field: location

0 commit comments

Comments
 (0)