Skip to content

Commit bf38e59

Browse files
committed
Documentation on aliased repopulation
1 parent 90a554f commit bf38e59

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Aliased Indexes
2+
===============
3+
4+
You can set up FOSElasticaBundle to use aliases for indexes which allows you to run an
5+
index population without resetting the index currently being used by the application.
6+
7+
> *Note*: When you're using an alias, resetting an individual type will still cause a
8+
> reset for that type.
9+
10+
To configure FOSElasticaBundle to use aliases for an index, set the use_alias option to
11+
true.
12+
13+
```yaml
14+
fos_elastica:
15+
indexes:
16+
website:
17+
use_alias: true
18+
```
19+
20+
The process for setting up aliases on an existing application is slightly more complicated
21+
because the bundle is not able to set an alias as the same name as an index. You have some
22+
options on how to handle this:
23+
24+
1) Delete the index from Elasticsearch. This option will make searching unavailable in your
25+
application until a population has completed itself, and an alias is created.
26+
27+
2) Change the index_name parameter for your index to something new, and manually alias the
28+
current index to the new index_name, which will then be replaced when you run a repopulate.
29+
30+
```yaml
31+
fos_elastica:
32+
indexes:
33+
website:
34+
use_alias: true
35+
index_name: website_prod
36+
```
37+
38+
```bash
39+
$ curl -XPOST 'http://localhost:9200/_aliases' -d '
40+
{
41+
"actions" : [
42+
{ "add" : { "index" : "website", "alias" : "website_prod" } }
43+
]
44+
}'
45+
```

Resources/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Available documentation for FOSElasticaBundle
1212
Cookbook Entries
1313
----------------
1414

15+
* [Aliased Indexes](cookbook/aliased-indexes.md)
1516
* [Custom Repositories](cookbook/custom-repositories.md)
1617
* [HTTP Headers for Elastica](cookbook/elastica-client-http-headers.md)
1718
* Performance - [Logging](cookbook/logging.md)

0 commit comments

Comments
 (0)