1

I am trying to use the PHP API, and same example as given in the code

https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_search_operations.html#_scrolling

$client = ClientBuilder::create()->build();
$params = [
    "scroll" => "30s",          // how long between scroll requests. should be small!
    "size" => 50,               // how many results *per shard* you want back
    "index" => "my_index",
    "body" => [
        "query" => [
            "match_all" => new \stdClass()
        ]
    ]
];

// Execute the search
// The response will contain the first batch of documents
// and a scroll_id
$response = $client->search($params);

But getting error like this Unknown key for a VALUE_STRING in [scroll].

Currently using Elasticsearch version 6.2.2

Any ideas?

2 Answers 2

1

The problem is that you put scroll parameter in json body, but it should be instead in the URL. e.g

index-name/_search?scroll=30s

Don't forget to remove it from $params as well

Sign up to request clarification or add additional context in comments.

Comments

0

You may have accidentaly put scroll attribute inside body.

1 Comment

Please add some code (avoiding scroll attribute) so other users can test what you're describing. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.