You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to documentation, with the filter context and supplying an in-memory doc:
The filter context runs the script as if the script were inside a script query. You must provide a test document in the context. The _source, stored fields, and _doc variables will be available to the script.
If I supply a "_source" attribute, OpenSearch complains about unknown field.
{
"context_setup":
"_source":
...
}
{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:239] [execute_script_context] unknown field [_source]"}],"type":"x_content_parse_exception","reason":"[1:250] [painless_execute_request] failed to parse field [context_setup]","caused_by":{"type":"x_content_parse_exception","reason":"[1:239] [execute_script_context] unknown field [_source]"}},"status":400}
If I include it in the document, I get metadata error:
{
"context_setup":
"document": {
"_source":
...
}
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Field [_source] is a metadata field and cannot be added inside a document. Use the index API request parameters."}],"type":"mapper_parsing_exception","reason":"failed to parse field [_source] of type [_source] in document with id '_id'. Preview of field's value: '{function=ecc, name=sec-t571k1, type=implementation}'","caused_by":{"type":"mapper_parsing_exception","reason":"Field [_source] is a metadata field and cannot be added inside a document. Use the index API request parameters."}},"status":400}
It is not clear how an in-memory document as part of the Request can include a _source per the document. I am testing a script that is accessing _source.
Related component
Other
To Reproduce
Issue a REST call to /_scripts/painless/_execute with a document containing a _source attribute.
Script can access the _source attribute per the documentation.
The filter context runs the script as if the script were inside a script query. You must provide a test document in the context. The _source, stored fields, and _doc variables will be available to the script.
Additional Details
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
According to documentation, with the filter context and supplying an in-memory doc:
If I supply a "_source" attribute, OpenSearch complains about unknown field.
If I include it in the document, I get metadata error:
It is not clear how an in-memory document as part of the Request can include a
_source
per the document. I am testing a script that is accessing_source
.Related component
Other
To Reproduce
Issue a REST call to
/_scripts/painless/_execute
with a document containing a_source
attribute.Expected behavior
Script can access the
_source
attribute per the documentation.Additional Details
No response
The text was updated successfully, but these errors were encountered: