Skip to main content
POST
/
1
/
compositions
/
{compositionID}
/
facets
/
{facetName}
/
query
curl
curl --request POST \
  --url https://algolia_application_id.algolia.net/1/compositions/my_composition_object_id/facets/lorem/query \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
  --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
  --data '{"params":{"query":"","maxFacetHits":10,"searchQuery":{"query":"","filters":"(category:Book OR category:Ebook) AND _tags:published","page":0,"getRankingInfo":false,"relevancyStrictness":90,"facetFilters":[["category:Book","category:-Movie"],"author:John Doe"],"optionalFilters":["category:Book","author:John Doe"],"numericFilters":[["inStock = 1","deliveryDate < 1441755506"],"price < 1000"],"hitsPerPage":20,"aroundLatLng":"40.71,-74.01","aroundLatLngViaIP":false,"aroundRadius":1,"aroundPrecision":10,"minimumAroundRadius":1,"insideBoundingBox":"lorem","insidePolygon":[[47.3165,4.9665,47.3424,5.0201,47.32,4.9],[40.9234,2.1185,38.643,1.9916,39.2587,2.0104]],"queryLanguages":["es"],"naturalLanguages":[],"enableRules":true,"ruleContexts":["mobile"],"userToken":"test-user-123","clickAnalytics":false,"analytics":true,"analyticsTags":[],"enableABTest":true,"enableReRanking":true,"injectedItems":{}}}}'
{
  "results": [
    {
      "indexName": "<string>",
      "facetHits": [
        {
          "value": "Mobile phone",
          "highlighted": "<em>George</em> <em>Clo</em>oney",
          "count": 123
        }
      ],
      "exhaustiveFacetsCount": true,
      "processingTimeMS": 20
    }
  ]
}
Required ACL: search

Authorizations

x-algolia-application-id
string
header
required

Your Algolia application ID.

x-algolia-api-key
string
header
required

Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.

Path Parameters

compositionID
string
required

Unique Composition ObjectID.

Example:

"my_composition_object_id"

facetName
string
required

Facet attribute in which to search for values.

This attribute must be included in the attributesForFaceting index setting with the searchable() modifier.

Body

application/json
params
object

Response

OK

results
object[]

Search for facet values results.

I