Adding some documentation
This commit is contained in:
parent
73fd4fe6b0
commit
c99eee9c4b
59
README.md
59
README.md
|
@ -58,6 +58,23 @@ Most of the time, you will need only one.
|
|||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
|
||||
|
||||
#### Declare a serializer
|
||||
|
||||
Elastica can handle objects instead of data arrays if a serializer callable is configured
|
||||
|
||||
#app/config/config.yml
|
||||
foq_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
|
||||
"callable_class" is the class name of a class having a public method serialize($object). "id" is the service id for the
|
||||
actual serializer, e.g. 'serializer' if you're using the JMSSerializerBundle. If this is configured you can use
|
||||
Elastica_Type::addObject instead of Elastica_Type::addDocument to add data to the index.
|
||||
|
||||
#### Declare an index
|
||||
|
||||
Elasticsearch index is comparable to Doctrine entity manager.
|
||||
|
@ -66,6 +83,9 @@ Most of the time, you will need only one.
|
|||
fos_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
|
@ -96,6 +116,9 @@ Elasticsearch type is comparable to Doctrine entity repository.
|
|||
fos_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
|
@ -109,11 +132,38 @@ Elasticsearch type is comparable to Doctrine entity repository.
|
|||
|
||||
Our type is now available as a service: `fos_elastica.index.website.user`. It is an instance of `Elastica_Type`.
|
||||
|
||||
### Declaring serializer groups
|
||||
|
||||
If you are using the JMSSerializerBundle for serializing objects passed to elastica you can define serializer groups
|
||||
per type.
|
||||
|
||||
foq_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
types:
|
||||
user:
|
||||
mappings:
|
||||
username: { boost: 5 }
|
||||
firstName: { boost: 3 }
|
||||
lastName: { boost: 3 }
|
||||
aboutMe:
|
||||
serializer:
|
||||
groups: [elastica, Default]
|
||||
|
||||
### Declaring parent field
|
||||
|
||||
fos_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
|
@ -129,6 +179,9 @@ Our type is now available as a service: `fos_elastica.index.website.user`. It is
|
|||
fos_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
|
@ -164,6 +217,9 @@ some configuration will let ElasticaBundle do it for us.
|
|||
fos_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
|
@ -281,6 +337,9 @@ Declare that you want a Doctrine/Propel finder in your configuration:
|
|||
fos_elastica:
|
||||
clients:
|
||||
default: { host: localhost, port: 9200 }
|
||||
serializer:
|
||||
callable_class: %classname%
|
||||
id: serializer
|
||||
indexes:
|
||||
website:
|
||||
client: default
|
||||
|
|
Loading…
Reference in a new issue