1// docs/bulk.asciidoc:405
2
3[source, php]
4----
5$params = [
6    'body' => [
7        [
8            'update' => [
9                '_id' => '1',
10                '_index' => 'index1',
11                'retry_on_conflict' => 3,
12            ],
13        ],
14        [
15            'doc' => [
16                'field' => 'value',
17            ],
18        ],
19        [
20            'update' => [
21                '_id' => '0',
22                '_index' => 'index1',
23                'retry_on_conflict' => 3,
24            ],
25        ],
26        [
27            'script' => [
28                'source' => 'ctx._source.counter += params.param1',
29                'lang' => 'painless',
30                'params' => [
31                    'param1' => 1,
32                ],
33            ],
34            'upsert' => [
35                'counter' => 1,
36            ],
37        ],
38        [
39            'update' => [
40                '_id' => '2',
41                '_index' => 'index1',
42                'retry_on_conflict' => 3,
43            ],
44        ],
45        [
46            'doc' => [
47                'field' => 'value',
48            ],
49            'doc_as_upsert' => true,
50        ],
51        [
52            'update' => [
53                '_id' => '3',
54                '_index' => 'index1',
55                '_source' => true,
56            ],
57        ],
58        [
59            'doc' => [
60                'field' => 'value',
61            ],
62        ],
63        [
64            'update' => [
65                '_id' => '4',
66                '_index' => 'index1',
67            ],
68        ],
69        [
70            'doc' => [
71                'field' => 'value',
72            ],
73            '_source' => true,
74        ],
75    ],
76];
77$response = $client->bulk($params);
78----
79