elasticsearch\ActiveRecord getOldPrimaryKey()

getOldPrimaryKey() public method Returns the old primary key value(s). This refers to the primary key value that is populated into the record after executing a find method (e.g. find(), findOne()). The value remains unchanged even if the primary key attribute is manually assigned with a different value. public mixed getOldPrimaryKey ( $asArray = false )$asArray boolean Whether to return the primary key value as an array. If true, the return value will be an array with column name as key

elasticsearch\ActiveRecord getHighlight()

getHighlight() public method public array|null getHighlight ( )return array|null A list of arrays with highlighted excerpts indexed by field names.

elasticsearch\ActiveRecord getDb()

getDb() public static method Returns the database connection used by this AR class. By default, the "elasticsearch" application component is used as the database connection. You may override this method if you want to use a different database connection. public static yii\elasticsearch\Connection getDb ( )return yii\elasticsearch\Connection The database connection used by this AR class.

elasticsearch\ActiveRecord get()

get() public static method Gets a record by its primary key. public static static|null get ( $primaryKey, $options = [] )$primaryKey mixed The primaryKey value $options array Options given in this parameter are passed to elasticsearch as request URI parameters. Please refer to the elasticsearch documentation for more details on these options. return static|null The record instance or null if it was not found.

elasticsearch\ActiveRecord findOne()

findOne() public static method Returns a single active record model instance by a primary key or an array of column values. The method accepts: a scalar value (integer or string): query by a single primary key value and return the corresponding record (or null if not found). a non-associative array: query by a list of primary key values and return the first record (or null if not found). an associative array of name-value pairs: query by a set of attribute values and return a single record

elasticsearch\ActiveRecord findAll()

findAll() public static method Returns a list of active record models that match the specified primary key value(s) or a set of column values. The method accepts: a scalar value (integer or string): query by a single primary key value and return an array containing the corresponding record (or an empty array if not found). a non-associative array: query by a list of primary key values and return the corresponding records (or an empty array if none was found). Note that an empty condition wi

elasticsearch\ActiveRecord find()

find() public static method Creates an \yii\elasticsearch\ActiveQueryInterface instance for query purpose. The returned \yii\elasticsearch\ActiveQueryInterface instance can be further customized by calling methods defined in \yii\elasticsearch\ActiveQueryInterface before one() or all() is called to return populated ActiveRecord instances. For example, // find the customer whose ID is 1 $customer = Customer::find()->where(['id' => 1])->one(); // find all active customers and order

elasticsearch\ActiveRecord deleteAll()

deleteAll() public static method Deletes rows in the table using the provided conditions. WARNING: If you do not specify any condition, this method will delete ALL rows in the table. For example, to delete all customers whose status is 3: Customer::deleteAll(['status' => 3]); See also [[yii\elasticsearch\ActiveRecord::primaryKeysByCondition()]]. public static integer deleteAll ( $condition = [] )$condition array The conditions that will be passed to the where() method when building t

elasticsearch\ActiveRecord delete()

delete() public method Deletes the table row corresponding to this active record. This method performs the following steps in order: call beforeDelete(). If the method returns false, it will skip the rest of the steps; delete the record from the database; call afterDelete(). In the above step 1 and 3, events named EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE will be raised by the corresponding methods. public integer|boolean delete ( $options = [] )$options array Options given in this para

elasticsearch\ActiveRecord attributes()

attributes() public method Returns the list of all attribute names of the model. This method must be overridden by child classes to define available attributes. Attributes are names of fields of the corresponding elasticsearch document. The primaryKey for elasticsearch documents is the _id field by default which is not part of the attributes. You may define path mapping for the _id field so that it is part of the _source fields and thus becomes part of the attributes. public string[] attr