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 \
| public static string[] primaryKey ( ) | ||
| return | string[] |
Array of primary key attributes. Only the first element of the array will be used. |
|---|---|---|
public static function primaryKey()
{
return ['_id'];
}