-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Deterministic JSON serialization and deserialization support in Painless (should be deterministic) #37585
Comments
Pinging @elastic/es-core-infra |
👍 on Strng json = '{"obj": {"l": [1,2, 3]}}';
HashMap o = loads(json);
o.obj.l.add(4);
// return {"obj":{"l":[1,2,3,4]}}
return dumps(o); Ideally this would also support Supported types for |
PR sent in #60925 |
#63278 has been merged which is based on #60925, thanks! That is a great step forward 👍 It does not yet ensure deterministic serialization so I would like to keep this issue open. See discussion in #60925 (comment) Cc: @stu-elastic |
Agreed this issue should be kept open, there is need for deterministic serialization. |
This has been open for quite a while, and we haven't made much progress on this due to focus in other areas. For now I'm going to close this as something we aren't planning on implementing. We can re-open it later if needed. |
@rjernst Can you please set the correct issue status then? "Deterministic" is in the title but is not solved. This could otherwise give then wrong impression when people search for issues. |
Describe the feature:
The Painless API reference does not contain any function that deals with JSON. Would it be possible to provide basic JSON functionally in Painless? If possible the serialization should be deterministic, see below.
I am including full ES document dumps in emails send by watches. Because the
toJson
Mustache function is not deterministic I needed to implement my own deterministic serialization function in Painless and realized that this is somewhat painful (e.g. not as it should be ;-) ).This has been asked before: https://discuss.elastic.co/t/painless-scripting-json-functions/98511
For reference, this is my workaround. My code does not produce valid JSON and probably has bugs (not extensively tested). To work without regex support in Painless, I also put HTML indent support into this function.
The text was updated successfully, but these errors were encountered: