-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Open
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustache>enhancementTeam:Core/InfraMeta label for core/infra teamMeta label for core/infra team
Description
Description
Hi,
I would to be able to use the field API like in runtime fields $('field name', 'fallback') in an ingest context.
This would allow me to write the following:
set:
if: $('field', false)
Instead of writing this
set:
if: ctx.field != null
I should also be able to do this, e.g. run the contains operator on a String.
if: $('field', '').contains('abc')
And this should also be covered:
if: ['abc','def'].contains($('field',''))
Only thing when doing this: if: $('field', false) it might happen that the field is a number, string and not boolean. Can we do the same as possible in other programming languages, where it just acts as truthy /falsy As soon as there is a value that is not false, it is automatically true?
So this example:
doc:
{ "_source": { "user": "philipp" }}
set:
field: demo
value: cool
if: $('user', false)
then yields:
{
"user": "philipp",
"demo": "cool"
}herrBez
Metadata
Metadata
Assignees
Labels
:Core/Infra/ScriptingScripting abstractions, Painless, and MustacheScripting abstractions, Painless, and Mustache>enhancementTeam:Core/InfraMeta label for core/infra teamMeta label for core/infra team