Tip: Updating Elasticsearch synonyms list on-the-fly
mikko.ropanen
Spryker Solution Partner Posts: 27 ✨ - Novice
So it came up that many Spryker customers wish there was a backoffice GUI for maintaining a synonyms list for the site search. Well there isn't, but technically it's a relatively simple operation:
// Get index $index = $this->client->getIndex($this->indexName); // Close index $index->close(); // Update settings $newSettings['analysis']['filter']['synonym_graph_filter']['synonyms'] = $synonyms; // Persist new settings $index->setSettings($newSettings); // Open index $index->open();
where $this→client
is an \Elastica\Client
and $synonyms
is just an array.
Hope this is useful for someone!
Tagged:
5
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 68 Spryker News
- 890 Developer Corner
- 753 Spryker Development
- 83 Spryker Dev Environment
- 360 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 22 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