This kind of model was created to use Index as table. For using this feature, you must extend your class to \Baka\Elasticsearch\Objects\Documents.
This class have these methods:
Following the same patterns as Phalcon models, on initialize, we set up the relationships (nested fields) this document has in order for the query params to work.
For creating the index, run the following command
- The first param is the class for model
- The second is the max depth
- The third represents max fields in that index
In order to insert data to Elastic, you will just need to initialize your Elastic document object, and pass the Phalcon model to the insert data function.
If you want to insert data from CLI, use the following command