Flex::ModelIndexer
Notice: The
Flex::ModelIndexer
includes alsoFlex::ModelSyncer
(see Flex::ModelSyncer)
Flex avoids polluting your models with many methods: indeed it adds just 1 class method and 3 instance methods, all starting with the flex
prefix to avoid confusion:
Model.flex
record.flex
record.flex_source
record.flex_indexable?
Besides you can define a Model.flex_result
method in order to customize the results (see Model.flex_result)
Class Methods
flex
|
You access all the Flex features included in your model through the |
flex.index
|
By default the index used for all the models in your app is the
|
flex.type
|
By default the type used for your model is the full-underscored class name. For example
|
flex.parent
|
Defines elasticsearch parent/child relations (see Indexing Records). |
flex.sync(*synced)
|
Implemented by the |
flex.synced
|
Implemented by the |
flex_result(result)
|
Custom defined method (see Model.flex_result). |
Instance Methods
You usually don’t need to deal with this methods unless you sync manually or have very special needs.
flex
|
The |
flex.index
|
The index for this record. |
flex.type
|
The document type for this record. |
flex.store
|
Indexes the |
flex.remove
|
Removes the elasticsearch document for this record. It is used internally and you don’t need to use this directly if you use |
flex.sync
|
Implemented by the |
flex.get
|
Retrieves the elasticsearch document from the index. The result is extended as usual (see Flex Extenders, Flex Model Extenders and Flex Rails Extenders). Mostly useful in the console to inspect the elasticsearch related document.
|
flex_source
|
(see Indexing Records) |
flex_indexable?
|
(see Indexing Fields) |
Overriding Flex Metafields | |
---|---|
flex_id , flex_index , flex_type , flex_parent , flex_routing
|
Use only if you know what you are doing!
The |