Managing Search API Facets
Who is this article for?
Users who need to search records that meet a variety of requirements and assist with populating data repositories
Restricted access to Users with interface development roles. It is a read-only HTTP/JSON API.
Search API facets are a powerful feature that allows users to break down and categorize their search results in a more meaningful way by adding counts and sub counts from specific values. This functionality is particularly useful for data analysis and retrieval.
Currently, there are several types of facets options available to users, each designed to cater to different analytical needs. These options provide a way to segment the data, making it easier to understand trends and patterns within the dataset.
Facets are not static; there are plans to expand the range of options available in the future. This means that users can look forward to additional features and enhancements that will further refine their ability to analyze and manipulate data effectively. The ongoing development in this area reflects a commitment to improving user experience and meeting the evolving needs of data analysis.
Facet Types
Currently supported facet types and any specific fields they support. All facets require type to be set.
| Type | Required Fields | Supported Fields |
|---|---|---|
terms |
type, field | facet, mincount, offset, limit, sort, missing, numBuckets, prefix |
range |
type, field | facet, start, end, gap, hardened, other, include |
query |
type, query | facet |
pivot |
type, fields | limit, statTag |
Facet Fields
The fields that are supported by the various facet types and what they do
| Key | Type | Description |
|---|---|---|
type |
String |
This must match up to one of our supported facet types |
field |
String |
The field you would like to bucket on |
fields |
List of Strings |
The fields you would like to bucket on, in the order that you want them bucketed |
facet |
Map of Facets |
Nested buckets within this bucket. allows sub bucketing values |
mincount |
Integer |
minimum number of values in the bucket before it's allowed to be returned. defaults to 0 |
query |
Search Query |
A query defined above to search for documents that match the query |
limit |
Integer |
the max number of buckets to return in the bucket |
offset |
Integer |
the number of buckets to skip. used for paging results |
sort |
String |
How to sort the buckets. Defaults to "count desc" |
missing |
Boolean |
include a count for documents that do not have a value in the requested field |
numBuckets |
Boolean |
include a count of the number of buckets |
prefix |
String |
Only produce buckets for values starting with the specified prefix |