vvr02
vvr02

Reputation: 611

Elasticsearch Unknown key for a VALUE_STRING in [scroll]

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?

Upvotes: 1

Views: 3976

Answers (2)

Mysterion
Mysterion

Reputation: 9320

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

Upvotes: 1

NikosK
NikosK

Reputation: 1

You may have accidentaly put scroll attribute inside body.

Upvotes: 0

Related Questions