Page tree
Skip to end of metadata
Go to start of metadata

Overview

Each document in the index contains a number of internal fields that are available at query time. These fields all start with a period (".").

Virtual field values cannot be set or modified at ingest time. Virtual fields specified on ingested documents will be ignored.

View incoming links.

 

Virtual Field Table

The following table shows the names of all virtual fields available and the features supported for them.

Virtual Field

search

stored

facet

sort

.id

yes

yes

no

no

.zone

yes

yes

yes

no

.score

no

yes

no

yes

.fields

yes

no

yes

no

The .id Virtual Field

The .id virtual field provides the ability to search on and request the document id for a document.

Example Query

OR(.id:documentid1, .id:documentid2, .id:documentid3)

Example: requesting document id as a field

QueryRequest request = new QueryRequest("*:*");
request.addField(FieldNames.ID);

The .zone Virtual Field

The .zone virtual field provides the ability to filter on and return the zone that documents are indexed in.

Example Query

AND(.zone:default, .id:documentid)

Example: requesting zone name and document id

QueryRequest request = new QueryRequest("*:*");
request.addField(FieldNames.ZONE);
request.addField(FieldNames.ID);

The .score Virtual Field

The .score virtual field provides the ability use the document's score in more complex field expressions as well as sort based on the score of a document.

Example: requesting score as a field

QueryRequest request = new QueryRequest("*:*");
request.addField(FieldNames.SCORE);

Example: Sorting on document's score

QueryRequest request = new QueryRequest("*:*");
request.addSort( new Sort(FieldNames.SCORE, Sort.SortOrder.DESCENDING) );

The .fields Virtual Field

The .fields virtual field is mainly useful for faceting. This makes it possible to see which fields are populated for documents that match a particular query.

Example: faceting on .fields

QueryRequest request = new QueryRequest("*:*");
request.addFacetField( FieldNames.FIELD_NAMES );

 

 

  • No labels