Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs not up2date? Trying to append an object to a nested array. #1183

Open
Atomzwieback opened this issue Dec 13, 2021 · 1 comment
Open

Comments

@Atomzwieback
Copy link

Summary of problem or feature request

Current PHP Docs seems not be up2date?

Code snippet of problem

This example as you show it in the docs dont work?

$params = [
    'index' => 'my_index',
    'id'    => 'my_id',
    'body'  => [
        'script' => 'ctx._source.counter += count',
        'params' => [
            'count' => 4
        ]
    ]
];

$response = $client->update($params);

The error i got is: "[UpdateRequest] unknown field [params]"

System details

  • Operating System
    MacOs

  • PHP Version
    8.0

  • ES-PHP client version
    7.16

  • Elasticsearch version
    Cloud 7.16.1

@ziko1153
Copy link

ziko1153 commented Mar 29, 2022

@Atomzwieback Ya i m facing same issue. i think it should be something like that

 $params = [
                'index' => 'products',
                'body' => [
                    'script' => [
                        'lang' => 'painless',
                        'source' => 'ctx._source.name = params.name;ctx._source.brand = params.brand;ctx._source.category = params.category',
                        'params' => [
                            'name' => 'foo bar',
                            'brand' => 'brand',
                            'category' => 'category'
                        ]
                    ],
                    'query' => [
                        'ids' => [
                            'values' => [1,5]
                        ]
                    ]

                ]
            ];

return $this->client->updateByQuery($params);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants