Vespa models data as documents. A document have a string identifier, set by the application, unique across all documents. A document is a set of key-value pairs. A document has a schema (i.e. type), defined in the search definition.
When configuring clusters, a documents element set what document types a cluster is to store. This configuration is used to configure the garbage collector if it is enabled. Additionally it is used to define default routes for documents sent into the application. By default, a document will be sent to all clusters having the document type defined. Refer to routing for details.
Vespa uses the document ID to distribute documents to nodes. From the document identifier, the content layer calculates a numeric location. A bucket contains all the documents, where a given amount of least significant bits of the location are all equal. This property is used to enable co-localized storage of documents - read more in buckets and elastic Vespa.
The document identifiers are URIs, represented by a string, which must conform to a defined URI scheme for document identifiers. Schemes have two parts:
|Namespace||Intended to be used to distinguish data from users who share the same Vespa cluster and/or distinguish between different document types in search. It is hence possible for various applications to use the same Vespa installation, ensuring they do not create document identifier collisions.|
|User specified||Application specific.|
Vespa has defined one scheme, the id scheme. Format: id:<namespace>:<document-type>:<key/value-pairs>:<user-specified>
|document-type||Required||Document type as defined in services.xml and the search definition|
Modifiers to the id scheme, used to configure document distribution. With no modifiers, the id scheme distributes all documents uniformly. The <key/value-pairs> field contains a comma-separated list of lexicographically sorted key/value pairs. n and g are mutually exclusive:
For instance, schemes specifying a groupname, will have the LSB bits of the location set to a hash of the groupname. Thus all documents belonging to that group will have locations with similar least significant bits, which will put them in the same bucket. If buckets end up split far enough to use more bits than the hash bits overridden by the group, the data will be split into many buckets, but each will typically only contain data for that group.
|user-specified||Required||A unique ID string|
$ curl http://hostname:8080/document/v1/music/music/docid/Michael-Jackson-Bad $ curl http://hostname:8080/document/v1/music/music/number/12345/Michael-Jackson-Bad $ curl http://hostname:8080/document/v1/music/music/group/mymusicsite.com/Michael-Jackson-Bad
Use fieldset to limit the fields that are returned from a read operation, like get or visit. Fieldsets should be considered hints to Vespa, used to optimize. It should not be considered an error if Vespa returns more fields than specified.
Note: Document field sets is a different thing than searchable fieldsets.
There are two options for specifying a field set:
|[all]||Returns all fields in the document, including the document ID.|
|[none]||Returns no fields at all, not even the document ID. Internal, do not use|
|[id]||Returns only the document ID|
|<document type>:[document]||Returns only the original document fields (generated fields not included) together with the document ID. Supported for indexed search only.|
music:title,artistAlso find examples in visiting.