ride/app-orm-elastic

Elastic search integration for the Ride ORM.

1.1.0 2017-02-08 10:39 UTC

This package is auto-updated.

Last update: 2024-10-21 19:35:27 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

Installation

You can use Composer to install this application.

composer require ride/app-orm-elastic