Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Swaz's avatar
Level 20

How are you managing your MeiliSearch index configs?

Let's say I have an index called movies, and I would like to add synonyms, as per the docs:

https://docs.meilisearch.com/reference/api/synonyms.html#update-synonyms

$client->index('movies')->updateSynonyms([
  'wolverine' => ['xmen', 'logan'],
  'logan' => ['wolverine', 'xmen'],
  'wow' => ['world of warcraft']
]);

Should I put this code in a command that runs every time I deploy? What are you guys doing?

I used to use Algolia Scout Extended to manage my configs:

https://www.algolia.com/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended/?client=php

0 likes
3 replies
johncarter's avatar

I'd love to know the best way to do this too; did you come up with an alternative solution to the console command?

Swaz's avatar
Level 20

@johncarter I never did. Running a console command on deploy seems reasonable to me though.

FatimaMazhit's avatar

If someone needs it: In https://laravel.com/docs/10.x/scout#configuring-filterable-data-for-meilisearch you can configure attributes as well as other settings. I didn't encounter settings which i couldn't change yet. Just don't forget php artisan scout:sync-index-settings. For example:

'meilisearch' => [
      	'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
        'key' => env('MEILISEARCH_KEY'),
        'index-settings' => [
            'clients' => [
                'filterableAttributes' => ['id', 'name', 'company.name_ru', 'contacts.phone'],
                'typoTolerance' => ['disableOnAttributes' => ['contacts.phone']],
                'synonyms' => [
                  'wolverine' => ['xmen', 'logan'],
 				  'logan' => ['wolverine', 'xmen'],
  				  'wow' => ['world of warcraft']
                ],
            ],
        ],
    ],
2 likes

Please or to participate in this conversation.