ride / app-orm-elastic
Elastic search integration for the Ride ORM.
Requires
- ride/app: ^1.0.0
- ride/app-elastic: ^1.0.0
- ride/app-orm: ^1.0.0
- ride/lib-event: ^1.0.0
- ride/lib-generator: ^1.0.0
- ride/lib-orm: ^1.0.0
This package is auto-updated.
Last update: 2024-11-21 19:50:58 UTC
README
This module will integrate Elasticsearch into the ORM.
To enable Elastic on your model, add the behaviour.elastic property to your model options. Set it to the index/type of your data in the Elasticsearch server eg. geo/locations.
When this behaviour is enabled, a method getElasticDocument will be generated in your entry class. This method will make the conversion between the ORM and Elastic.
The mapping to Elastic is based on your model definition. You can skip fields by adding the elastic.omit option to the field.
You will need the Elastic ORM commands for the CLI to define the mapping and to index existing records. Whenever a manipulation is done (insert, update or delete), the index is automatically updated.
Note: when you enable the json API, you can add the elastic filter to add search through Elastic.
<model name="GeoLocation"> <field name="path" type="string"> <validation name="required"/> </field> <field name="parent" model="GeoLocation" relation="belongsTo"> <option name="elastic.omit" value="true"/> </field> <field name="name" type="string" localized="true"> <validation name="required"/> </field> <option name="behaviour.elastic" value="geo/locations"/> <option name="json.api" value="geo-locations"/> <option name="json.api.filters" value="query,exact,match,expression,elastic"/> </model>
Related Modules
- ride/app
- ride/app-elastic
- ride/app-orm
- ride/cli-orm-elastic
- ride/lib-event
- ride/lib-generator
- ride/lib-orm
Installation
You can use Composer to install this application.
composer require ride/app-orm-elastic