Skip to Content
Mixedbread

Get Metadata Facets

Get metadata facets

POST
/v1/stores/metadata-facets

Authorization

ApiKeyAuth
headerAuthorizationBearer <token>

Api key to access Mixedbreads API

Request Body

application/json
  1. body

The parameters for getting metadata facets

store_identifiers*array<string|>

IDs or names of stores

Items1 <= items <= 64
filters?||array<|>|

Optional filter conditions

file_ids?array<any>|array<>|

Optional list of file IDs to filter chunks by (inclusion filter)

query?|

Search query text

top_k?Top K

Number of results to return

Range1 <= value <= 10000
Default10
search_options?

Search configuration options

facets?array<string>|

Optional list of facets to return. Use dot for nested fields.

max_fields?Max Fields

Maximum number of distinct metadata fields (keys) to return.

Range1 <= value <= 256
Default64
max_values_per_field?Max Values Per Field

Maximum number of distinct values returned per field, ranked by count.

Range1 <= value <= 256
Default32
max_files?Max Files

Maximum number of store files scanned to compute facets.

Range1 <= value <= 100000
Default10000

Response Body

The metadata facets

application/json
  1. response

Represents metadata facets for a store.

facets*

Metadata facets

Example Request
from mixedbread import Mixedbread

mxbai = Mixedbread(api_key="YOUR_API_KEY")

response = mxbai.stores.metadata_facets(
    store_identifiers=["my-knowledge-base"],
    facets=["author", "year"],
)

print(response.facets)
Example Response
{
  "facets": {
    "category": {
      "report": 3,
      "press": 2
    },
    "year": {
      "2022": 1,
      "2023": 2,
      "2024": 2
    },
    "author.name": {
      "alice": 2,
      "bob": 1,
      "carol": 2
    }
  }
}