Get Metadata Facets
POST/v1/stores/metadata-facets
AuthorizationLink to section
Bearer token for API authentication. Format: `Bearer YOUR_API_KEY`
Request BodyLink to section
IDs or names of stores
Constraints
10Number of results to return
Constraints
Optional list of file IDs to filter chunks by (inclusion filter). Use list only for inclusion or specify an operator (`in` or `not_in`). Example: ["file_id_1", "file_id_2"] or ["not_in", ["file_id_1", "file_id_2"]].
Search query text
Constraints
Optional list of facets to return. Use dot for nested fields.
64Maximum number of distinct metadata fields (keys) to return.
Constraints
32Maximum number of distinct values returned per field, ranked by count.
Constraints
10000Maximum number of store files scanned to compute facets.
Constraints
Response BodyLink to section
Metadata facets, keyed by field name. Each value is a map of facet value to occurrence count. Nested fields use dot notation.
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){
"facets": {
"category": {
"report": 3,
"press": 2
},
"year": {
"2022": 1,
"2023": 2,
"2024": 2
},
"author.name": {
"alice": 2,
"bob": 1,
"carol": 2
}
}
}