curl - Use elastic/elasticsearch-php to scroll documents but got 404 exception -
i using official elastic/elasticsearch-php scroll documents got 404 exception when sending second scroll request. here comes code.
$client = clientbuilder::create()->sethosts(['mykibana.domain'])->build(); $params = [ 'index' => 'my_index', 'scroll' => '30s', 'size' => 100, 'body' => [ 'query' => [ 'filtered' => [ 'query' => [ 'query_string' => [ 'query' => "\"https://myapplication.domain/orders\"", 'analyze_wildcard' => true ] ] ] ] ] ]; $response = $client->search($params); while (isset($response['hits']['hits']) && count($response['hits']['hits']) > 0) { // processing $response['hits']['hits']... $scrollid = $response['_scroll_id']; $response = $client->scroll([ 'scroll_id' => $scrollid, 'scroll' => '30s' ] ); }
the while loop same scroll sample in elasticsearch documentation
the error [elasticsearch\common\exceptions\missing404exception] {"statuscode":404,"error":"not found"}
.
software version: php 5.6.3 , elastic/elasticsearch-php 2.0.
appreciate help!
update: tried use curl directly scroll documents again got 404 exception @ second curl. ideas?
curl 'http://mykibana.domain/my_index/_search?pretty&scroll=30s' -h 'content-type: application/json' -d '{"size":10, "query":{"filtered":{"query":{"query_string":{"query":"\"https://myapplication.domain/orders\"","analyze_wildcard":true}}}}}' curl 'http://mykibana.domain/_search/scroll' -h 'content-type: application/json' -h 'kbn-version: 4.4.2' -d '{"scroll":"30s","scroll_id":"cxvlcnluagvurmv0y2g7ntszmtyynze6zfvzvwlmn29sefdpovzwwvy3rta1qtszmtyynzi6zfvzvwlmn29sefdpovzwwvy3rta1qtszmtyynzu6zfvzvwlmn29sefdpovzwwvy3rta1qtszmtyynzq6zfvzvwlmn29sefdpovzwwvy3rta1qtszmtyynzm6zfvzvwlmn29sefdpovzwwvy3rta1qtswow=="}'
Comments
Post a Comment