README.pod

The only unique key available in Elasticsearch is the document ID.
Typically,
if you want a document to be unique,
you use the unique value as the ID.
However,
sometimes you don't want to do this.
For instance,
you may want to use the email address as a unique identifier for your user accounts,
but you also want to be able to link to a user account without exposing their email address.

ElasticSearchX::UniqueKey allows you to keep track of unique values by maintaining a dedicated index which can contain multiple types.
Each type represents a different key name (so a single index can be used to track multiple unique keys).

First tries to create the new combination key_name/new_id, otherwise returns false. Once created, it then tries to delete the key_name/old_id, and returns true regardless of whether it existed previously or not.

Use "multi_create()" to create several entries at the same time (each $key_name must be different). If it fails to create all the entries, then it will remove any entries that it succeeded in creating, and return a hash of the entries which failed.