0a958e486ede3f519d48431ab689eded.asciidoc 431 B

12345678910111213141516171819202122
  1. // docs/update.asciidoc:271
  2. [source, php]
  3. ----
  4. $params = [
  5. 'index' => 'test',
  6. 'id' => '1',
  7. 'body' => [
  8. 'script' => [
  9. 'source' => 'ctx._source.counter += params.count',
  10. 'lang' => 'painless',
  11. 'params' => [
  12. 'count' => 4,
  13. ],
  14. ],
  15. 'upsert' => [
  16. 'counter' => 1,
  17. ],
  18. ],
  19. ];
  20. $response = $client->update($params);
  21. ----