Spryker: How to implement ES index recreation by switching the index on fly?
We want to update ElasticSearch synonyms in “page” index. With current implementation, we first delete the index and then run ES reindex. This causes ~2h gap that all products aren’t visible.
$PHP_BIN vendor/bin/console elasticsearch:index:delete $PHP_BIN vendor/bin/console search:setup:sources $PHP_BIN vendor/bin/console publish:trigger-events
Does someone have any hints how to implement ES index recreation by switching the index on fly? Thanks!
Answers
-
You could try closing the needed indexes, updating the settings with the synonyms and opening the indexes again. In this case, you don't need to recreate them.
Example to perform it on the fly:
$this->elasticaClient->request( $indexName . '/_close', Request::POST, ); // Read the
page.json
settings file into$settings
and add the structure:$settings['analysis']['filter']['b2b_mp_synonyms']['synonyms'][] = "bench => chair"; $this->elasticaClient->request( $indexName . '/_settings', Request::PUT, $settings, ); $this->elasticaClient->request( $indexName . '/_open', Request::POST, );
Caveat:
The closed indexes can't be accessed before they are opened again.
1 -
If your Spryker Project is working in our PaaS, and you're willing to do some additional work, I recommend you, @PatrikTorn, to look at this solution:
Here you will find complete solution with necessary automation supported by Lambda function.
1 -
How would you get started with this solution in practice? I think most people don't have the IAM permissions to create packages or Lambdas in the Spryker cloud.
0 -
That's correct, to make this happen please create a support ticket explaining what you need, and attach the documentation and/or extracts from it.
0 -
fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,056 ⚖️ - Guardians (admin)
btw, I just discovered that this topic is in the wrong subcategory - I will move it to the Spryker development questions :)
All the best,
Florian
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 69 Spryker News
- 896 Developer Corner
- 758 Spryker Development
- 83 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 23 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random