Skip to content

Commit c901d60

Browse files
committed
Clarified what index_name does. Closes #731
1 parent 32d190f commit c901d60

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Resources/doc/setup.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,28 @@ fos_elastica:
4848
clients:
4949
default: { host: localhost, port: 9200 }
5050
indexes:
51-
search: ~
51+
app: ~
5252
```
5353
5454
In this example, an Elastica index (an instance of `Elastica\Index`) is available as a
55-
service with the key `fos_elastica.index.search`.
55+
service with the key `fos_elastica.index.app`.
5656

57-
If the Elasticsearch index name needs to be different to the service name in your
58-
application, for example, renaming the search index based on different environments.
57+
You may want the index `app` to be named something else on ElasticSearch depending on
58+
if your application is running in a different env or other conditions that suit your
59+
application. To set your customer index to a name that depends on the environment of your
60+
Symfony application, use the example below:
5961

6062
```yaml
6163
#app/config/config.yml
6264
fos_elastica:
6365
indexes:
64-
search:
65-
index_name: search_dev
66+
app:
67+
index_name: app_%kernel.env%
6668
```
6769

68-
In this case, the service `fos_elastica.index.search` will be using an Elasticsearch
69-
index of search_dev.
70+
In this case, the service `fos_elastica.index.app` will relate to an ElasticSearch index
71+
that varies depending on your kernel's environment. For example, in dev it will relate to
72+
`app_dev`.
7073

7174
D) Defining index types
7275
-----------------------
@@ -81,7 +84,7 @@ will end up being indexed.
8184
```yaml
8285
fos_elastica:
8386
indexes:
84-
search:
87+
app:
8588
types:
8689
user:
8790
mappings:
@@ -92,7 +95,7 @@ fos_elastica:
9295
```
9396

9497
Each defined type is made available as a service, and in this case the service key is
95-
`fos_elastica.index.search.user` and is an instance of `Elastica\Type`.
98+
`fos_elastica.index.app.user` and is an instance of `Elastica\Type`.
9699

97100
FOSElasticaBundle requires a provider for each type that will notify when an object
98101
that maps to a type has been modified. The bundle ships with support for Doctrine and

0 commit comments

Comments
 (0)