As of 7.0
, Lucene expression-based scripted fields have been deprecated, and you can only create new scripted fields using Painless. We are doing this for consistency with Elasticsearch, which removed support for Expression filters.
If you have previously created Expression scripted fields, you can still use them in 7.x
, you just won't be able to edit or change them. Starting in 8.0
support will be removed entirely and folks will need to migrate existing scripted fields to Painless -- at that time we will also be removing the language selection dropdown to prevent confusion.
There are a bunch more details in this issue if you are curious: https://github.com/elastic/kibana/issues/77669
Thanks @lukeelmers
I know we can add numbers in a field using sum aggregation in visualization, but is there any way to add all numbers in a field using scripted fields (lang : painless, as we can't use expressions)
Unfortunately no, to perform an aggregation in the Kibana UI, you'd need to configure it with a visualization of some type.
A scripted field only has access to the individual document, so for example if you had multiple numbers in different fields of a document that you wanted to sum, you could do that...
{
a: 1,
b: 2,
my_scripted_field: 3 // script: doc['a'].value + doc['b'].value
}
...but you won't be able to do a proper aggregation on all returned documents.
Okay, thanks @lukeelmers
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.