Elasticsearch painless script php

Elasticsearch update by query can't update field with null value

$a = NULL;
$b = NULL;

'script' => [
'inline' => "ctx._source.a = $a; ctx._source.b = $b;",
'lang' => 'painless',
],

give me compile error "script_stack":["... x._source.a = ; ctx._source.b ..." invalid sequence of tokens near [';']

it's work if we change $a and $b variable as below

$a = 'null';
$b = 'null';

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.