-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[data views] Field editor endpoint versioning and schema validation #159626
Conversation
…-ref HEAD~1..HEAD --fix'
…na into bwci_runtime_field_preview
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! But I did run into one output validation issue when testing composite runtime fields.
This is the field I was trying to create (I disabled output validation to get this screenshot):
With the validation enabled, I got this toast:
And this error response:
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "Failed output validation: [request body.values]: types that failed validation:\n- [request body.values.0.composite_field.test]: types that failed validation:\n - [request body.0]: expected value of type [boolean] but got [Array]\n - [request body.1]: expected value of type [number] but got [Array]\n - [request body.2]: expected value of type [string] but got [Array]\n - [request body.3]: expected a plain object value, but found [Array] instead.\n- [request body.values.1]: expected value of type [array] but got [Object]"
}
And for reference, the script I was using:
Map map = new HashMap();
map.put("first","Foo");
map.put("last", "Bar");
emit(map);
emit('map', map);
emit('test', 'test');
emit('test2', 2555);
emit('test3', [99, 99]);
And the success response with validation disabled:
{
"composite_field.test": ["test"],
"composite_field.first": ["Foo"],
"composite_field.last": ["Bar"],
"composite_field.test2": [2555],
"composite_field.test3": [[99, 99]],
"composite_field.map": [
{
"last": "Bar",
"first": "Foo"
}
]
}
@davismcphee I need to talk to the painless engineers - either you've found an undocumented feature or a bug. Either way, passing maps and arrays to emit isn't documented - https://www.elastic.co/guide/en/elasticsearch/painless/8.8/painless-runtime-fields-context.html |
@mattkime I think calling I'm not sure if The array in this case is actual a To be fair though, I couldn't find explicit mention of using Either way though, composite fields seem to fail validation regardless of which values are used. I used complex types in my example to be comprehensive in testing, but even a composite field containing just primitive types currently fails validation. I believe it's because we're expecting
|
@davismcphee I spoke to some ES engineers and the consensus was that passing an array or map to Past that, everything should work now. |
💚 Build Succeeded
Metrics [docs]Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @mattkime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying which subfield types are supported! Since maps and arrays aren't valid, everything seems to be working as expected, LGTM 👍
Summary
Closes #159158