Field Facet Stage
A field facet query computes the top values for a field and returns the list of those values along with a count of the subset
of documents in the search results which match that term.
Field faceting works best over fields which contain a single label or set of labels from a finite, controlled lexicon
such as product category.
Facet field parameters can be tuned for performance, see:
Facet Field Configuration.
It is possible to specify more than one field facets.
For each field facet you must specify the field name plus the following additional parameters:
-
Limit. The maximum number of terms to be returned. Default 100.
-
Offset. The number of top facet values to skip in the response. Default 0.
-
Sort. The order in which to list facet values: count
ordering is by documents per term, descending, and index
ordering is sorted on term values themselves.
-
Missing. The number of documents in the results set which have no value for the facet field.
-
Choice of facet method (advanced). Specify Solr algorithm used to calculate facet counts.
(See Facet Method Configuration for details).
One of:
-
enum
. Small number of distinct categories.
-
fc
("field cache"). Many different values in the field, each document has low number of values, multi-valued field.
-
fcs
("single value string fields"). Good for rapidly changing indexes.
Configure range or field facets. Facets indicate categories and aggregations of results according to values in the configured fields
skip - boolean
Set to true to skip this stage.
Default: false
label - string
A unique label for this stage.
<= 255 characters
condition - string
Define a conditional script that must result in true or false. This can be used to determine if the stage should process or not.
fieldFacets - array[object]
object attributes:{field
required : {
display name: Field
type: string
}prefix
: {
display name: Prefix
type: string
}sort
: {
display name: Sort
type: string
}limit
: {
display name: Limit
type: integer
}offset
: {
display name: Offset
type: integer
}minCount
: {
display name: Minimum Count
type: integer
}missing
: {
display name: Count Missing
type: boolean
}method
: {
display name: Method
type: string
}enumCacheMinDf
: {
display name: Enum Cache Minimum DF
type: integer
}ensuredValues
: {
display name: Ensured Facet Values
type: array
}threads
: {
display name: NO LONGER USED.
type: integer
}}
threads - integer
Specifies how many threads the search engine will use while loading the underlying fields used in faceting. Recommended that this is kept at 0 or blank, which means the data is loaded in the thread already running the query. Only supported on non DSL requests.
rangeFacets - array[object]
object attributes:{field
required : {
display name: Field
type: string
}start
required : {
display name: Start
type: string
}end
required : {
display name: End
type: string
}gap
required : {
display name: Gap
type: string
}hardEnd
: {
display name: Hard End
type: boolean
}minCount
: {
display name: Minimum Count
type: integer
}method
: {
display name: Method
type: string
}include
: {
display name: Include
type: array
}other
: {
display name: Other
type: array
}}