algolia / algolia/search-bundle

Missing documentation on how to handle replicas

Open
#348 5 comments 4 reactions 0 assignees View on GitHub
Needs attention
Dominant language
PHP
Stars
193
Forks
74
PR merge metrics
No merged PRs in 30d

Description

- Symfony version: 4.4.5
- Algolia Search Bundle version: 4.1.0
- Algolia Client Version: 2.5.1
- Language Version: 7.4.1

### Description
The current documentation about the integration of the search bundle is missing how to handle replicas the right way.
I was able to sort some steps out and bypass the issue which is mentioned in: https://github.com/algolia/search-bundle/issues/269.

My target is to provide an index with multiple replicas and distinct sort configurations, aside from that it must me possible to export all index settings and apply them during an application deployment.

#### 1. Backup and restore index configurations using the cli **search:settings:backup**:
- if an index is listet in the **algolia_search.yaml** it's configuration will be exported as expected, including the information about it's replicas
- the configuration from the replicas itself are **not** exported this way

To also export the configurations of the replicas, it is required to list them all one by one in the **algolia_search.yaml** as seen down in the section "**Steps To Reproduce**".

#### 2. Import data into an index using the cli **search:import**:
- if the index and it's replicas are configured in the **algolia_search.yaml**, an import will lead to an exception during the unwanted push to a replica instead to the master:
```
In ApiWrapper.php line 210:

cannot apply a add object request on a replica index
```

To bybass this issue it is required to provide the `--indices` option with the name of the master index. It is also required that the master index has to be the last which is configured in the **algolia_search.yaml**. This is the mentioned bypass for the issue: https://github.com/algolia/search-bundle/issues/269.

### Steps To Reproduce
Example **algolia_search.yaml** to show how it is currently possible to use replicas with the search bundle.
```
algolia_search:
prefix: ""
doctrineSubscribedEvents: []
indices:
- name: index_property_asc
class: Vendor\Orm\Entity\IndexEntity

- name: index_property_desc
class: Vendor\Orm\Entity\IndexEntity

- name: index
class: Vendor\Orm\Entity\IndexEntity
```

### Summary
I would really like to see additional informations about this in the official documentation on how to do it the right way.

Also i would really appreciate further improvements in the search bundle to either be able to avoid the requirement to configure each replica or to be able to provide a specific configuration for them and also a proper handling for replicas in the cli to avoid unwanted exceptions during import.

Contributor guide

Open the contributing guide

Research direction

Start with the Algolia Search Bundle documentation for algolia_search.yaml and the search:settings:backup and search:import commands, then review the reported replica behavior and ApiWrapper.php line 210. Done means the official documentation explains configuring replicas, exporting their settings, and importing only through the master index, including the --indices workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
cli, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.