Replies: 4 comments
-
Hello @kbond, That is sure an interesting idea and aliases are something I already had on my list because I also think it make reindexing easier. The algolias I need to let this go to my head if you have more information how this is supported in
Curious why you see this as part of SchemaManager and not part of the Indexer? PS: Currently a migration with Zero-downtime can also be achieved manually via a read-write adapter configuration currently some more configuration and manual switching required but still possible: Step 1: Configure different read write indexes schranz_search:
index_name_prefix: '%env(TEST_INDEX_PREFIX)%'
schemas:
default:
dir: '%kernel.project_dir%/config/schemas'
engine: default
engines:
read:
adapter: '%env(SEAL_READ_DSN)%'
write:
adapter: '%env(SEAL_WRITE_DSN)%'
# multi: # would be possible to use as write adapter if still want to write into both indexes
# adapter: 'multi://read?adapters[]=write'
default:
adapter: 'read-write://read?write=write' Step 2: Configure different read write ENV SEAL_READ_DSN=elasticsearch://127.0.0.1:9200
SEAL_WRITE_DSN=algolia://ALGOLIA_APPLICATION_ID:ALGOLIA_PRIVATE_KEY Step 3: Reindex Then reindex Step 4: Use same DSN to read and write form same source SEAL_READ_DSN=algolia://ALGOLIA_APPLICATION_ID:ALGOLIA_PRIVATE_KEY
SEAL_WRITE_DSN=algolia://ALGOLIA_APPLICATION_ID:ALGOLIA_PRIVATE_KEY It's not yet documented, as I'm not yet fan of the configuration, but this way a zero downtime migration from elasticsearch to algolia is currently possible from one adapter to another. What I sure want to support is a Still doesn't solve your problem if you want todo a complete reindex as a cronjob, just wanted to mention it here that kind of zero migration from one to another DSN is supported over a manually mechanism. But this manually mechanism is only require if the bin/console schranz:search:reindex --engine default --index blog So that also could at current state also be used as a cronjob as it does not drop the index. I need a little bit experiment around with the aliases and replaceAll and check the other engines to get then back what the best way for reindex interface here. If you have any more hints and experience here how you currenlt ydid implement it let me know. Its maybe also related to |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed reply! I'm excited to dig into this library!
Fair point. I believe the manual way would be to create a new (temporary) index (ie blog__temp), configure/populate it like normal, then call moveIndex().
Unfortunately, I have no experience with these others.
I just quickly looked though the code and saw
Interesting! When I make the switch from elasticsearch to algolia I'm not concerned about downtime. More just the cronjob as discussed. |
Beta Was this translation helpful? Give feedback.
-
I could currently found this for the other engines:
So in most cases it is working via an
Yeah maybe that make sense 🤔 first thought it as part of the A question which pops in is I'm thinking in which case the reindexing should be do the reindex on the current live index and in which cases we should do it over alias mechanism. Maybe connected to the $reindexProvidersPerIndex = [];
// ...
if ($dropIndex && $this->schemaManager instanceof ReindexableSchemaManagerInterface) {
foreach ($reindexProvidersPerIndex as $index => $reindexProviders) {
$this->schemaManager->reindex($this->schema->indexes[$index], $reindexProviders, ?callable $progressCallback = null);
}
return;
}
// else fallback to the current mechanism What do you think about this? EDIT: Not sure if I want to give
I'm curious about the usecase that a normal reindex update documents from source is not working in your case? As that would also be zero downtime when you just update the documents in the existing index? Does in your case the Index get out of Sync that documents are not removed when related entity is removed and so you need build the index always from new that this old documents are not longer part of the index? |
Beta Was this translation helpful? Give feedback.
-
Yes, exactly, this is just a process I've used for a long time. Admittedly, it perhaps needs to be re-thought.
I have converted over to algolia (using their sdk directly) and these are the commands I've created:
Just wanted to note some algolia-specific features I created:
What's nice about this is you can create all your settings/synonyms/rules in Algolia's UI (maybe in a development index), then save them to your project. Part of your deployment process could be to push the settings back up. In my case, my nightly repopulate job ensures the latest settings are pushed. I'm not sure exactly how this feature could/should be tied into this package... For searching my algolia index, I've heavily customized the query options: $results = $index->search($query, [
'X-Forwarded-For' => $request->getClientIp(), // "unique" search tracking (for non-logged in users)
'userToken' => $user->id(), // "unique" search tracking for logged in users
'facetFilters' => [
['locale:'.$_locale], // this is already handled by this package
],
'clickAnalytics' => true, // required for algolia events
'attributesToHighlight' => [], // remove extra stuff from response I don't need
'attributesToRetrieve' => [ // restrict result data to just the fields I need
'url',
'status',
'image',
'title',
'subtitle1',
'subtitle2',
],
]); Again, this is just demonstrating my current use-case/need. |
Beta Was this translation helpful? Give feedback.
-
My app has a simple search system that I fully re-index in a cron job. This project looks very interesting! Currently, I'm using elasticsearch but looking to switch to algolia.
To avoid downtime during the re-index, I have two indexes that I swap between with an alias.
Algolia has a similar feature: https://www.algolia.com/doc/api-reference/api-methods/replace-all-objects/
Curious if there is interest in this feature in SEAL. Maybe a
ReindexableSchemaManagerInterface
?Beta Was this translation helpful? Give feedback.
All reactions