UUID Datatype
Edit pageA UUID field stores a UUID as specified in RFC 4122. A value is accepted when it has the UUID format (the version is not checked, so versions 1, 3, 4 and 5 are accepted, and the version 6 ones the node mints).
UPDATE /bank/1
{ "guid": "1f1e8f3f-471f-4b3d-a2a4-7aefb43a9087"}Condensed UUIDs
Section titled “Condensed UUIDs”Xapiand supports a subset of UUID 1 (and the version 6 codec the node mints by default)
which can be represented as strings in condensed form, ~ followed by the encoded
bytes. The ID the node generates for a document with no ID of its own is such a
condensed UUID, version 6 by default and version 1 with --legacy-ids; so an index whose
first document has no ID has a uuid _id (an index whose first ID is a number or a
string takes that type instead, see Index Document API).
For example, the UUID 00000000-0000-1000-8000-010000000000 can be represented
as the string “~notmet”.
UUIDs as Field Names
Section titled “UUIDs as Field Names”Objects which contain UUIDs as field names are detected as a objects with Dynamic Field Names by default. This means, in the following example, all fields will add a single field specification and that will be shared among all four field values.
UPDATE /bank/1
{ "uuids": { "a8098c1a-f86e-11da-bd1a-00112444be1e": "uuid1", "6fa459ea-ee8a-3ca4-894e-db77e160355e": "uuid3", "16fd2706-8baf-433b-82eb-8c7fada847da": "uuid4", "886313e1-3b8a-5372-9b90-0c9aee199e5d": "uuid5" }}_index_uuid_field can be used to specify how the UUID field namess will be
indexed:
- The default, type “uuid”, stores the field name as the UUID value itself.
- The type “uuid_field” stores the field name as the string “<uuid_field>”.
- The type “both” stores the field name as both the UUID value and as “<uuid_field>”.