Skip to content

Better/safer access of missing values in Painless #33816

@costin

Description

@costin

Describe the feature:

Currently in master, the correct way to access a doc value is to do a check on size ( see #32207) to avoid an exception when dealing with missing values: doc['field'].size() > 0

However our examples do not use this form (though the docs mentions that in a paragraph).
Without this check, a document with missing fields can cause a working Painless script to throw an exception which is unexpected.
As discussed in the search/aggs meeting it would be desirable to have an intuitive, short and safe access to the doc value regardless of the existence of the value.

Maybe related to #25913 /cc @nik9000

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions