Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Aws\CloudSearch\CloudSearchClient;
- use \Config;
- public function index()
- {
- $cloudSearchClient = CloudSearchClient::factory(Config::get("wdna-aws::cloudsearch"));
- $domainClient = $cloudSearchClient->getDomainClient(
- 'catalog-items',
- ['credentials' => Config::get("wdna-aws::cloudsearch")]
- );
- $result = $domainClient->search([
- 'query' => 'matchall',
- 'queryParser' => 'structured',
- 'size' => '100'
- ])->toArray();
- foreach ($result['hits']['hit'] as $hit) {
- $documents[] = [
- 'type' => 'delete',
- 'id' => $hit['id']
- ];
- }
- $domainClient->uploadDocuments([
- 'contentType' => 'application/json',
- 'documents' => json_encode($documents)
- ]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement