Before testing re-indexing make sure that cron is stopped and not running. Messages consumer has to be stopped.
Full re-index
(Optional) Clean queue_message and magento_operation tables
DELETE FROM queue_message WHERE topic_name like "hawksearch.%"; DELETE FROM magento_operation where topic_name like "hawksearch.%";
Get the list of indexes via API (Postman)
Request:curl --location --request GET 'https://indexing-dev.hawksearch.net/api/v2/indexing/' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'X-HawkSearch-ApiKey: <API_KEY>' \ --data-raw ''
Result:
{ "IndexNames": [ "magentoelastic.20220427.111354", "magentoelastic.20220426.153846" ] }
Get current index name (Postman)
Request:curl --location --request GET 'https://indexing-dev.hawksearch.net/api/v2/indexing/current' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'X-HawkSearch-ApiKey: <API_KEY>' \ --data-raw ''
Result:
{ "IndexName": "magentoelastic.20220426.153846" }
Re-index via CLI command
bin/magento indexer:reindex hawksearch_products
Review changes in indexes list via API (Postman). Make that non-current index
"magentoelastic.20220427.111354"
has been removed and a new one"magentoelastic.20220504.143505"
has been created
Request:curl --location --request GET 'https://indexing-dev.hawksearch.net/api/v2/indexing/' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'X-HawkSearch-ApiKey: <API_KEY>' \ --data-raw ''
Result:
{ "IndexNames": [ "magentoelastic.20220504.143505", "magentoelastic.20220426.153846" ] }
Review changes in queue_message and magento_operation tables
Make sure that a bulk of new messages is created in queue_message table and corresponding operations are created in magento_operation table. The queue_message.body and magento_operation.serialized_data columns contain the newly created index name
"magentoelastic.20220504.143505"
in their text values.Process messages one by one. The number of messages handled at the same time can be controlled via
--max-messages
parameter.bin/magento queue:consumers:start --max-messages=1 hawksearch.indexing
After the last message is processed (message topic is hawksearch.indexing.fullreindex.finish) check via API (Postman) that current index is changed to
magentoelastic.20220504.143505
Request:curl --location --request GET 'https://indexing-dev.hawksearch.net/api/v2/indexing/current' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'X-HawkSearch-ApiKey: <API_KEY>' \ --data-raw ''
Result:
{ "IndexName": "magentoelastic.20220504.143505" }
Partial re-index in “Update by Schedule” mode
(Optional) Clean queue_message and magento_operation tables
DELETE FROM queue_message WHERE topic_name like "hawksearch.%"; DELETE FROM magento_operation where topic_name like "hawksearch.%";
Demonstrate the list of indexes via API (Postman)
Get current index name (Postman)
Update any product data
Demonstrate that no messages in queue_message table yet
Run cron to trigger indexer_update_all_views job
bin/magento cron:run --group=index
Demonstrate the created messages in queue_message table
Process messages:
bin/magento queue:consumers:start --max-messages=1 hawksearch.indexing
Demonstrate index is not changed
Demonstrate that index is triggered in Hawk API Logs
Demonstrate a new item created in the index (run API search)
Partial re-index in “Update on Save” mode
Clean queue_message table
Demonstrate the list of indexes via API (Postman)
Get current index name (Postman)
Update any product data
Demonstrate the created messages in queue_message table
Process messages:
bin/magento queue:consumers:start --max-messages=1 hawksearch.indexing
Demonstrate index is not changed
Demonstrate that index is triggered in Hawk API Logs
Demonstrate a new item created in the index (run API search)