younifyd
Menu

Search for facet values

Search for facet values

POST/indexes/{index_uid}/facet-search

Use it in a workflow

  1. Add a step and choose the Meilisearch connector.
  2. Pick the Search for facet values action (under Facet Search).
  3. Fill in the fields below, then reference the result from later steps as {{searchForFacetValues.response.data}}.

Request

Path parameters

index_uidstringrequired

Unique identifier of the index.

Request body

Enter the body as JSON in the step's Body field.

facetQuerystring | null

Query string to search for matching facet values. If not specified, Meilisearch returns all facet values for the `facetName`, limited to 100 results. Note: only the first word is used for matching.

facetNamestringrequired

Name of the facet attribute to search. Must be present in the index's `filterableAttributes` list.

qstring | null

Query string to filter the underlying documents before computing facet values. This affects which facet values appear and their counts, but does not filter the facet values themselves.

vectorarray | null

Custom query vector for semantic search

mediaany

Multimodal content for AI-powered search

hybridoneOf
filterany

Filter expression to restrict which documents are considered when computing facet values. Attributes must be in `filterableAttributes` before they can be used in filters.

matchingStrategyoneOf
attributesToSearchOnarray | null

Restrict search to specified attributes

rankingScoreThresholdnumber | null

Minimum ranking score threshold (0.0 to 1.0) that documents must achieve to be considered when computing facet counts. Documents with scores below this threshold are excluded from facet value counts.

localesarray | null

Languages to use for query processing

exhaustiveFacetCountboolean | null

Return exhaustive facet count instead of an estimate

useNetworkboolean | null

When `true`, runs the query on the whole network (all shards covered exactly once). When `false`, the query runs locally. When omitted or `null`, the default value depends on whether the sharding is enabled for the instance: - If the instance has sharding enabled (has a leader), defaults to `true`. - Otherwise defaults to `false`. It also requires the `network` [experimental feature](http://localhost:3000/reference/api/experimental-features/configure-experimental-features). Values: `true` = use the whole network; `false` = local, default = see above. When using the network, the index must exist with compatible settings on all remotes.

json
{
  "facetName": "string",
  "facetQuery": "string",
  "q": "string",
  "vector": null,
  "media": null,
  "hybrid": null,
  "filter": null,
  "matchingStrategy": null,
  "attributesToSearchOn": null,
  "rankingScoreThreshold": 0,
  "locales": null,
  "exhaustiveFacetCount": false
}

Response

Returns 200 with an object. Read it in later steps with {{searchForFacetValues.response.data.<field>}}.

facetHitsarray<object>

Array of matching facet values with their document counts, sorted lexicographically in ascending order (or by count if `sortFacetValuesBy` is set to `"count"`).

valuestringrequired

The facet value that matched the query.

countinteger (u-int64)required

Number of documents with this facet value among the search results.

facetQuerystring | null

The original `facetQuery` from the request. `null` if no query was provided.

processingTimeMsinteger

Time in milliseconds Meilisearch took to process the request.

remoteErrorsobject | null

Errors from remote shards. Only present in federated search when some remotes failed.

json
{
  "facetHits": [
    {
      "value": "string",
      "count": 0
    }
  ],
  "processingTimeMs": 0,
  "facetQuery": "string",
  "remoteErrors": {}
}

Need more? See the Meilisearch guide for connection setup and behaviour shared by every action.