PHP code example of novaway / elasticsearch-client
1. Go to this page and download the library: Download novaway/elasticsearch-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$objectIndexer = new \Novaway\ElasticsearchClient\ObjectIndexer($index);
$objectIndexer->index($object, 'my_type');
$objectIndexer = new \Novaway\ElasticsearchClient\ObjectIndexer($index);
$objectIndexer->remove($object, 'my_type');
// Alternatively, you can remove an indexed object knowing only it's ID.
$objectIndexer->removeById($objectId, 'my_type');
$queryExecutor = new \Novaway\ElasticsearchClient\QueryExecutor($index);
$index->hotswapToTmp();
// at that point, all your search request will go to the tmp index, and your create/delete will go to the main index
// when your are done reindexing your data, simply call
$index->hotswapToMain()
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.