elasticsearch\ActiveRecord primaryKey()

primaryKey() public static method

This method defines the attribute that uniquely identifies a record.

The primaryKey for elasticsearch documents is the _id field by default. This field is not part of the ActiveRecord attributes so you should never add _id to the list of attributes.

You may override this method to define the primary key name when you have defined path mapping for the _id field so that it is part of the _source and thus part of the attributes.

Note that elasticsearch only supports one attribute to be the primary key. However to match the signature of the ActiveRecordInterface this methods returns an array instead of a single string.

public static string[] primaryKey ( )
return string[]

Array of primary key attributes. Only the first element of the array will be used.

doc_Yii
2016-10-30 17:01:26
Comments
Leave a Comment

Please login to continue.